# "HEADERS on invalid stream"

**URL:** <https://help.nextcloud.com/t/headers-on-invalid-stream/65966>\
**Category:** 📦 Appliances (Docker, Snappy, VM, NCP, AIO)\
**Tags:** ncp\
**Created:** [December 10, 2019, 7:42pm UTC](https://help.nextcloud.com/t/headers-on-invalid-stream/65966 "2019-12-10T19:42:29Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![OveS](https://help.nextcloud.com/user_avatar/help.nextcloud.com/oves/32/17782_2.png) [@OveS](https://help.nextcloud.com/u/OveS)\
**Post date:** [December 10, 2019, 7:42pm UTC](https://help.nextcloud.com/t/headers-on-invalid-stream/65966/1 "2019-12-10T19:42:29Z")

</div>

The Linux client 2.6.1git displays above error message for a new .pdf file that is should be synced to my NCPi server (17.0.1)

Another file, a modified .ods spreadsheet also ends up having a red error message in the client, “Error transferring file …”

Here’s an extract from nextcloud.log:  
`"message":{"Exception":"Sabre\\DAV\\Exception\\BadRequest","Message":"Expected filesize of 242126 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 8192 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.`

These errors occur after the update to 17.0.1 (and NCP 1.19.1)

Edit Dec 12: Errors also in my Android client: “Bad request” for new photo in InstantUpload

---

<div class="post-metadata">

**Author:** ![OveS](https://help.nextcloud.com/user_avatar/help.nextcloud.com/oves/32/17782_2.png) [@OveS](https://help.nextcloud.com/u/OveS)\
**Post date:** [December 17, 2019, 9:23pm UTC](https://help.nextcloud.com/t/headers-on-invalid-stream/65966/2 "2019-12-17T21:23:11Z")

</div>

Checked the Logging section in the web interface after reboot, and the log is filling up with rows like this:

[PHP] Error: curl\_exec(): Unable to create temporary file, Check permissions in temporary files directory. at /var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/Handler/CurlHandler.php#40

I checked the Nextcloud temp directory permissions, and they look ok:

drwxr-x— 2 www-data www-data 4096 Dec 17 06:25 tmp

Here’s more from the Logging section:

[no app in context] Error: Sabre\DAV\Exception\BadRequest: Expected filesize of 163458 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 8192 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side. at \<\>

1. /var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php line 156  
OCA\DAV\Connector\Sabre\File-\>put(null)
2. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 1096  
OCA\DAV\Connector\Sabre\Directory-\>createFile(“IMG-20191213-WA0001.jpg”, null)
3. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 525  
Sabre\DAV\Server-\>createFile(“InstantUpload/W … g”, null, null)
4. \<\>  
Sabre\DAV\CorePlugin-\>httpPut(Sabre\HTTP\Reque … "}, Sabre\HTTP\Response {})
5. /var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105  
undefinedundefinedcall\_user\_func\_array([Sabre\DAV\CorePlugin {},“httpPut”], [Sabre\HTTP\Requ … }])
6. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 479  
Sabre\Event\EventEmitter-\>emit(“method:PUT”, [Sabre\HTTP\Requ … }])
7. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 254  
Sabre\DAV\Server-\>invokeMethod(Sabre\HTTP\Reque … "}, Sabre\HTTP\Response {})
8. /var/www/nextcloud/apps/dav/appinfo/v1/webdav.php line 80  
Sabre\DAV\Server-\>exec()
9. /var/www/nextcloud/remote.php line 163  
undefinedundefinedrequire\_once("/var/www/nextcl … p")

PUT /remote.php/webdav/InstantUpload/WhatsApp%20Images/IMG-20191213-WA0001.jpg  
from xx.xx.xx.xx by oves at 2019-12-17T21:26:25+00:100:

---

<div class="post-metadata">

**Author:** ![lbiemans](https://help.nextcloud.com/letter_avatar/lbiemans/32/6_22734026db12803ebb3e059622ac3534.png) [@lbiemans](https://help.nextcloud.com/u/lbiemans)\
**Post date:** [December 18, 2019, 10:54am UTC](https://help.nextcloud.com/t/headers-on-invalid-stream/65966/3 "2019-12-18T10:54:16Z")

</div>

Hi,

Have you confirmed the tmp path in php.ini?  
Please also note the php.ini file in your php-fpm directory.

In our case setting the correct path there fixed this issue (after a php-fpm reload 🙂 ).

---

<div class="post-metadata">

**Author:** ![OliverV](https://help.nextcloud.com/user_avatar/help.nextcloud.com/oliverv/32/5741_2.png) [@OliverV](https://help.nextcloud.com/u/OliverV)\
**Post date:** [December 18, 2019, 11:16am UTC](https://help.nextcloud.com/t/headers-on-invalid-stream/65966/4 "2019-12-18T11:16:32Z")

</div>

/etc/php/7.3/fpm/php.ini

In some instances this line:

> ; Defaults to the system default (see sys\_get\_temp\_dir)  
> sys\_temp\_dir = /var/www/nextcloud/data/tmp

Edit to point to your ncdata  
commenting out the line works too.

as

> ; Defaults to the system default (see sys\_get\_temp\_dir)  
> ;sys\_temp\_dir = “/tmp”

seems to be default

---

<div class="post-metadata">

**Author:** ![OveS](https://help.nextcloud.com/user_avatar/help.nextcloud.com/oves/32/17782_2.png) [@OveS](https://help.nextcloud.com/u/OveS)\
**Post date:** [December 18, 2019, 12:35pm UTC](https://help.nextcloud.com/t/headers-on-invalid-stream/65966/5 "2019-12-18T12:35:07Z")

</div>

Thank you! Fixed the temp dir path in /etc/php/7.3/fpm/php.ini, rebooted the server, and now my Android and iOS clients synchronize as they should.

However, my Linux Mint laptop has problems: the 2.6.1git client seems to connect but nothing happens, the Activity window is blank.

Logging page (web interface) shows several lines like this:  
[PHP] Error: fread(): file created in the system’s temporary directory at /var/www/nextcloud/3rdparty/icewind/streams/src/Wrapper.php#91

PUT /remote.php/webdav/Photos/2019/12/19-12-13%2023-06-36%200001.jpg  
from xx.xx.xx.xx by oves at 2019-12-18T12:24:38+00:100:

Should I “reset” the syncing somehow?

Edit: uninstalled Nextcloud-client and removed manually all config and other related files I could find, and then reinstalled. Now it’s resyncing the 31GB of stuff and seems to work as it should.

---

<div class="post-metadata">

**Author:** ![BeniBensn](https://help.nextcloud.com/user_avatar/help.nextcloud.com/benibensn/32/25131_2.png) [@BeniBensn](https://help.nextcloud.com/u/BeniBensn)\
**Post date:** [May 17, 2020, 9:00pm UTC](https://help.nextcloud.com/t/headers-on-invalid-stream/65966/8 "2020-05-17T21:00:32Z")

</div>

Thank you @OliverV for the hint with the **sys\_temp\_dir** option in **/etc/php/7.3/fpm/php.ini**

My solution for this is simply creating a symlink to _ **ncdata** _  
_# ln -s /media/USBdrive/ncdata /var/www/nextcloud/data_

worked for me

---

<div class="post-metadata">

**Author:** ![malte](https://help.nextcloud.com/letter_avatar/malte/32/6_22734026db12803ebb3e059622ac3534.png) [@malte](https://help.nextcloud.com/u/malte)\
**Post date:** [October 22, 2020, 11:40am UTC](https://help.nextcloud.com/t/headers-on-invalid-stream/65966/9 "2020-10-22T11:40:59Z")

</div>

Thank You, solved my problem!

---

<div class="post-metadata">

**Author:** ![ZackSpeed\_Jesus](https://help.nextcloud.com/user_avatar/help.nextcloud.com/zackspeed_jesus/32/14489_2.png) [@ZackSpeed\_Jesus](https://help.nextcloud.com/u/ZackSpeed_Jesus)\
**Post date:** [December 3, 2020, 6:16pm UTC](https://help.nextcloud.com/t/headers-on-invalid-stream/65966/10 "2020-12-03T18:16:18Z")

</div>

Thank You, solved my problem!

NCP [v1.32.1] 20.02 Raspi4 4gb

edit: “/etc/php/7.3/fpm/php.ini”

```
; Defaults to the system default (see sys_get_temp_dir)
 sys_temp_dir = /media/USBdrive/ncdata/tmp
```

---

<div class="post-metadata">

**Author:** ![Chewie](https://help.nextcloud.com/letter_avatar/chewie/32/6_22734026db12803ebb3e059622ac3534.png) [@Chewie](https://help.nextcloud.com/u/Chewie)\
**Post date:** [August 21, 2021, 3:45pm UTC](https://help.nextcloud.com/t/headers-on-invalid-stream/65966/11 "2021-08-21T15:45:20Z")

</div>

A few days ago this issue occured at my NextCloud 20.0.12.1. I could solve it thanks to OliverV (#4). But how can I make sure this issue won’t come again? How is it caused?

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 4, 2024, 12:24pm UTC](https://help.nextcloud.com/t/headers-on-invalid-stream/65966/12 "2024-12-04T12:24:44Z")

</div>



---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 11, 2024, 4:07pm UTC](https://help.nextcloud.com/t/headers-on-invalid-stream/65966/13 "2024-12-11T16:07:47Z")

</div>


