How to fix Nextcloud nextcloudcmd CLI "skipped due to earlier error, trying again in ..."

Problem:

Your Nextcloud CLI client fails for some files (upload or download) with an error message like this

"Server replied "413 Request Entity Too Large" to "PUT https://example.com/remote.php/dav/uploads/username/XXXXXXXX/YYYYYY" (skipped due to earlier error, trying again in 6 hour(s))
PATH/TO/FILE.bmp

Solution

The nextcloud CLI client nextcloudcmd stores the sync SQLite database in ~/.local/share/nextcloudcmd/._sync_############.db where ############ is a hex code. If you have multiple such files in ~/.local/share/nextcloudcmd, try out this procedure for each of them:

While nextcloudcmd is not running, use the SQLite3 command line tool to open the database, for example:

sqlite3 ~/.local/share/nextcloudcmd/._sync_bf15278da518.db

Then run this SQL command:

DELETE FROM 'blacklist';

and exit using Ctrl-D. Now try re-runningĀ nextcloudcmd, it should immediately retry syncing the file.