InvalidArgumentException: X-OC-MTime header must be a valid positive integer

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): replace me
Operating system and version (eg, Ubuntu 20.04): replace me
Apache or nginx version (eg, Apache 2.4.25): replace me
PHP version (eg, 7.4): replace me

The issue you are facing:

Is this the first time you’ve seen this error? (Y/N):

Steps to replicate it:

The output of your Nextcloud log in Admin > Logging:

PASTE HERE

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

PASTE HERE

The output of your Apache/nginx/system log in /var/log/____:

PASTE HERE

PASTE HERE

[webdav] Error: InvalidArgumentException: X-OC-MTime header must be a valid positive integer at <<closure>>

 0. /var/www/nextcloud/apps/dav/lib/Connector/Sabre/Node.php line 425
    OCA\DAV\Connector\Sabre\MtimeSanitizer::sanitizeMtime()
 1. /var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php line 378
    OCA\DAV\Connector\Sabre\Node->sanitizeMtime()
 2. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 1137
    OCA\DAV\Connector\Sabre\File->put()
 3. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 492
    Sabre\DAV\Server->updateFile("*** sensitive parameters replaced ***")
 4. /var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
    Sabre\DAV\CorePlugin->httpPut()
 5. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 472
    Sabre\DAV\Server->emit()
 6. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 253
    Sabre\DAV\Server->invokeMethod()
 7. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 321
    Sabre\DAV\Server->start()
 8. /var/www/nextcloud/apps/dav/lib/Server.php line 365
    Sabre\DAV\Server->exec()
 9. /var/www/nextcloud/apps/dav/appinfo/v2/remote.php line 35
    OCA\DAV\Server->exec()
10. /var/www/nextcloud/remote.php line 172
    require_once("/var/www/nextcl ... p")

PUT /remote.php/dav/files/nitish/Media/Phone%20Backup/Photos/IMG_20230317_110535.jpg
from 117.216.110.115 by nitish at 2023-10-24T05:42:41+00:00

Please fill out the template. We have no idea how you get the error, which version/apps/environment you are using.

have no idea what cause this issue. My issue come up after nextcloud migration. have one file name: .lastmodified in a folder, when i delete it, it come up again, this file no matter how i delete it, it come up again with the same name and date modified. when click on this file will get a error 404 page. I think this file stored in database but not in file system

I have similar problems with this error:

InvalidArgumentException: X-OC-MTime header must be a valid positive integer

And i found this on github:

Possible fix for that with these scripts:

But i have problems to get it working by this scripts.
So i tested this SQL command

SELECT COUNT(*) FROM oc_filecache WHERE mtime < 86400;

and got a number of files that have been affected.

As far as i can see from the logfiles, there are userdirs/pictures/…xxx.jpg files.
Seems coming from the android clients using autoupload feature for pics and videos.

Now my problem is that i don’t understand exactly how to use this

./solvable_files.sh <path to storage folder without trailing /> <mysql|pgsql> <database host> <database user> <database password> <database name> <list|fix> <noscan|scan>

i chmoded +x the script "solvable_files.sh

and i used:
path to storage folder = datadir of the nextcloud confugured in config.php??
then pgsql because i use postgresql
and then next dbuser, dbpass
i have chosen to use the postgres unix socket instead of username and pass
in nextcloud so how to use the fix / repair commend with the socket info??