Occ files:repair-tree produces SQL Error

Hi all,
I have the latest nextcloud docker installation (not aio) with a postgres database. When I run the occ files:repair-tree --dry-run I get a Found 29522 file entries with an invalid path. When I do it for real I get an

In ExceptionConverter.php line 87:

  An exception occurred while executing a query: SQLSTATE[22001]: String data, right truncated: 7 ERROR:  value too long for type character varying(4000)


In Exception.php line 28:

  SQLSTATE[22001]: String data, right truncated: 7 ERROR:  value too long for type character varying(4000)


In Statement.php line 130:

  SQLSTATE[22001]: String data, right truncated: 7 ERROR:  value too long for type character varying(4000)

after showing the line

Cache entry has already be recreated with id 3400442, deleting instead

for a hundred or so times…

Has anybody had the same problem or knows how to fix this?

I tried to files:scan --all and all occ repair options without any luck.

Let’s back up a moment. What lead you to running this command? It may be relevant.

I am getting the “User twilek still has unscanned files after running background scan, background scan might be stopped prematurely” every 15 minutes in my log file althought I had a complete file rescan complete without problems. So I was fishing for anything and thought that maybe there is orphaned stuff in my filesystem so I tried the tree repair.

Gotcha.

What happens when you do a regular occ files:scan? You mentioned you did that but I’m not clear what the results were.

It does sound like something is a bit weird about your filecache for some reason.

What’s the history of this installation?

Has it been around awhile? Ever moved the data directory? Etc.

The file scan runs through without problems:

Starting scan for user 1 out of 1 (twilek)
+---------+--------+-----+---------+---------+--------+--------------+
| Folders | Files  | New | Updated | Removed | Errors | Elapsed time |
+---------+--------+-----+---------+---------+--------+--------------+
| 6140    | 113225 | 0   | 0       | 0       | 0      | 00:06:04     |
+---------+--------+-----+---------+---------+--------+--------------+

It is a very old installation spanning I guess a minimum of 10 Versions of nextcloud with the data directory moved a couple of times. The database was changed from mariadb to postgresql. A lot of apps have been installed and removed again. So chances are high that there are wonky remnants. Having said that apart from the warnings in the log file it runs suprisingly smooth and without problems. Reinstalling would be a huge pain in the ****.

I ran the files:repair-tree with debug output. Then deleted the entries from the database. Then I did a complete file sacan. Now things all return no errors. And the log entries have ceased to appear.

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.