Error while running OCC command on Nextcloud AIO

I am having issues manually uploading files to Nextcloud. I have the docker AIO and have used rsync to copy about a TB of data from an external hard drive I have to Nextcloud. The copy went good, I saw online and learned from another article that I need to run this command to allow the files to show up… sudo docker exec --user www-data -it nextcloud-aio-nextcloud php occ files:scan --all. I ran that command but it’s giving me the following error…

Exception during scan: An exception occurred while executing a query: SQLSTATE[25P02]: In failed sql transaction: 7 ERROR:  current transaction is aborted, commands ignored until end of transaction block
#0 /var/www/html/3rdparty/doctrine/dbal/src/Connection.php(1780): Doctrine\DBAL\Driver\API\PostgreSQL\ExceptionConverter->convert(Object(Doctrine\DBAL\Driver\PDO\Exception), Object(Doctrine\DBAL\Query))
#1 /var/www/html/3rdparty/doctrine/dbal/src/Connection.php(1719): Doctrine\DBAL\Connection->handleDriverException(Object(Doctrine\DBAL\Driver\PDO\Exception), Object(Doctrine\DBAL\Query))
#2 /var/www/html/3rdparty/doctrine/dbal/src/Connection.php(1173): Doctrine\DBAL\Connection->convertExceptionDuringQuery(Object(Doctrine\DBAL\Driver\PDO\Exception), 'UPDATE "oc_file...', Array, Array)
#3 /var/www/html/lib/private/DB/Connection.php(294): Doctrine\DBAL\Connection->executeStatement('UPDATE "oc_file...', Array, Array)
#4 /var/www/html/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(354): OC\DB\Connection->executeStatement('UPDATE "oc_file...', Array, Array)
#5 /var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php(281): Doctrine\DBAL\Query\QueryBuilder->execute()
#6 /var/www/html/lib/private/Files/Cache/Cache.php(382): OC\DB\QueryBuilder\QueryBuilder->execute()
#7 /var/www/html/lib/private/Files/Cache/Scanner.php(403): OC\Files\Cache\Cache->update(161764, Array)
#8 /var/www/html/lib/private/Files/Cache/Scanner.php(394): OC\Files\Cache\Scanner->scanChildren('files/Backups/L...', true, 3, 161764, true)
#9 /var/www/html/lib/private/Files/Cache/Scanner.php(394): OC\Files\Cache\Scanner->scanChildren('files/Backups/L...', true, 3, 161752, true)
#10 /var/www/html/lib/private/Files/Cache/Scanner.php(394): OC\Files\Cache\Scanner->scanChildren('files/Backups/L...', true, 3, 161722, true)
#11 /var/www/html/lib/private/Files/Cache/Scanner.php(394): OC\Files\Cache\Scanner->scanChildren('files/Backups/L...', true, 3, 157429, true)
#12 /var/www/html/lib/private/Files/Cache/Scanner.php(394): OC\Files\Cache\Scanner->scanChildren('files/Backups/L...', true, 3, 91400, true)
#13 /var/www/html/lib/private/Files/Cache/Scanner.php(394): OC\Files\Cache\Scanner->scanChildren('files/Backups/L...', true, 3, 65007, true)
#14 /var/www/html/lib/private/Files/Cache/Scanner.php(394): OC\Files\Cache\Scanner->scanChildren('files/Backups', true, 3, 57019, true)
#15 /var/www/html/lib/private/Files/Cache/Scanner.php(394): OC\Files\Cache\Scanner->scanChildren('files', true, 3, 44111, true)
#16 /var/www/html/lib/private/Files/Cache/Scanner.php(342): OC\Files\Cache\Scanner->scanChildren('', true, 3, 3957, true, Array)
#17 /var/www/html/lib/private/Files/Utils/Scanner.php(256): OC\Files\Cache\Scanner->scan('', true, 3)
#18 /var/www/html/apps/files/lib/Command/Scan.php(161): OC\Files\Utils\Scanner->scan('/gclever', true, NULL)
#19 /var/www/html/apps/files/lib/Command/Scan.php(217): OCA\Files\Command\Scan->scanFiles('gclever', '/gclever', false, Object(Symfony\Component\Console\Output\ConsoleOutput), false, true, false)
#20 /var/www/html/3rdparty/symfony/console/Command/Command.php(255): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /var/www/html/core/Command/Base.php(177): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /var/www/html/3rdparty/symfony/console/Application.php(1009): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /var/www/html/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /var/www/html/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /var/www/html/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 /var/www/html/console.php(100): OC\Console\Application->run()
#27 /var/www/html/occ(11): require_once('/var/www/html/c...')
#28 {main}

I checked my Nextcloud site and it’s showing some of the files but not nearly all of them. It has some blank folders which should have files in them. Any idea on what the issue is?

Hi, can you check the database container logs? Also, did you apply the correct permissions to all files in your datadir?

Yes, I updated the permissions of all of my new data directory files. Where is that log file located?

You can get them with sudo docker logs nextcloud-aio-database

Ok… here is the error in the logs…

2023-01-12 18:30:34.121 EST [30146] ERROR:  invalid byte sequence for encoding "UTF8": 0xae
2023-01-12 18:30:34.121 EST [30146] CONTEXT:  unnamed portal parameter $8
2023-01-12 18:30:34.121 EST [30146] STATEMENT:  INSERT INTO "oc_filecache" ("mimepart", "mimetype", "mtime", "size", "etag", "storage_mtime", "permissions", "name", "parent", "checksum", "path_hash", "path", "storage") VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)
2023-01-12 18:30:34.125 EST [30146] ERROR:  current transaction is aborted, commands ignored until end of transaction block
2023-01-12 18:30:34.125 EST [30146] STATEMENT:  UPDATE "oc_filecache" SET "size" = $1 WHERE ("fileid" = $2) AND (("size" <> $3) OR ("size" IS NULL))

Do you think the issues is that one of the files I manually uploaded is corrupted or in a bad format? Is there a way to determine the file/files that are having issues being scanned so I can delete them?

Hm… looks like you have some files that you try to scan that don’t have an UTF-8 encoding?
You could maybe try to rename them but otherwise not clue, sorry.

Looks like it would probably make sense to open a bug report here: Sign in to GitHub · GitHub

2 posts were split to a new topic: Issue after migrating to AIO