Occ throws error

Hi,

when I try to run this command:

sudo -u www-data php occ files:scan --all

I get this error:

Exception during scan: An exception occurred while executing a query: SQLSTATE[25P02]: In failed sql transaction: 7 FEHLER:  aktuelle Transaktion wurde abgebrochen, Befehle werden bis zum Ende der Transaktion ignoriert
#0 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1728): Doctrine\DBAL\Driver\API\PostgreSQL\ExceptionConverter->convert()
#1 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1667): Doctrine\DBAL\Connection->handleDriverException()
#2 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1146): Doctrine\DBAL\Connection->convertExceptionDuringQuery()
#3 /var/www/nextcloud/lib/private/DB/Connection.php(262): Doctrine\DBAL\Connection->executeStatement()
#4 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(213): OC\DB\Connection->executeStatement()
#5 /var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php(287): Doctrine\DBAL\Query\QueryBuilder->execute()
#6 /var/www/nextcloud/lib/private/Files/Cache/Cache.php(379): OC\DB\QueryBuilder\QueryBuilder->execute()
#7 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(399): OC\Files\Cache\Cache->update()
#8 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(391): OC\Files\Cache\Scanner->scanChildren()
#9 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(391): OC\Files\Cache\Scanner->scanChildren()
#10 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(391): OC\Files\Cache\Scanner->scanChildren()
#11 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(391): OC\Files\Cache\Scanner->scanChildren()
#12 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(391): OC\Files\Cache\Scanner->scanChildren()
#13 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(340): OC\Files\Cache\Scanner->scanChildren()
#14 /var/www/nextcloud/lib/private/Files/Utils/Scanner.php(259): OC\Files\Cache\Scanner->scan()
#15 /var/www/nextcloud/apps/files/lib/Command/Scan.php(156): OC\Files\Utils\Scanner->scan()
#16 /var/www/nextcloud/apps/files/lib/Command/Scan.php(212): OCA\Files\Command\Scan->scanFiles()
#17 /var/www/nextcloud/apps/bookmarks/vendor/symfony/console/Command/Command.php(255): OCA\Files\Command\Scan->execute()
#18 /var/www/nextcloud/core/Command/Base.php(168): Symfony\Component\Console\Command\Command->run()
#19 /var/www/nextcloud/apps/bookmarks/vendor/symfony/console/Application.php(1009): OC\Core\Command\Base->run()
#20 /var/www/nextcloud/apps/bookmarks/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#21 /var/www/nextcloud/apps/bookmarks/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#22 /var/www/nextcloud/lib/private/Console/Application.php(209): Symfony\Component\Console\Application->run()
#23 /var/www/nextcloud/console.php(99): OC\Console\Application->run()
#24 /var/www/nextcloud/occ(11): require_once('...')
#25 {main}

But only for one user, where I copied some files per cli. The other users don’t throw an error.

This is my config.php:

root@cloud:/var/www/nextcloud# cat /var/www/nextcloud/config/config.php
<?php
$CONFIG = array (
  'passwordsalt' => 'xxx',
  'secret' => 'xxx',
  'trusted_domains' =>
  array (
    0 => 'xxx',
    1 => '192.168.100.156',
    2 => 'xxx',
    3 => 'xxx',
    4 => '192.168.10.156',
  ),
  'trusted_proxies' => '192.168.100.110',
  'datadirectory' => '/mnt/data',
  'dbtype' => 'pgsql',
  'version' => '22.1.0.0',
  'overwritehost' => 'xxx',
  'overwriteprotocol' => 'https',
  'overwrite.cli.url' => 'https://xxx',
  'dbname' => 'nextcloud_db',
  'dbhost' => '127.0.0.1',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud_db_user',
  'dbpassword' => 'xxx',
  'installed' => true,
  'instanceid' => 'xxx',
  'activity_expire_days' => 14,
  'auth.bruteforce.protection.enabled' => true,
  'blacklisted_files' =>
  array (
    0 => '.htaccess',
    1 => 'Thumbs.db',
    2 => 'thumbs.db',
  ),
  'cron_log' => true,
  'enable_previews' => true,
  'preview_libreoffice_path' => '/usr/bin/libreoffice',
  'enabledPreviewProviders' =>
  array (
    0 => 'OC\\Preview\\PNG',
    1 => 'OC\\Preview\\JPEG',
    2 => 'OC\\Preview\\GIF',
    3 => 'OC\\Preview\\BMP',
    4 => 'OC\\Preview\\XBitmap',
    5 => 'OC\\Preview\\Movie',
    6 => 'OC\\Preview\\PDF',
    7 => 'OC\\Preview\\MP3',
    8 => 'OC\\Preview\\TXT',
    9 => 'OC\\Preview\\MarkDown',
    10 => 'OC\\Preview\\OpenDocument',
    11 => 'OC\\Preview\\MSOffice2003',
    12 => 'OC\\Preview\\MSOfficeDoc',
    13 => 'OC\\Preview\\Image',
    14 => 'OC\\Preview\\Photoshop',
    15 => 'OC\\Preview\\TIFF',
    16 => 'OC\\Preview\\SVG',
    17 => 'OC\\Preview\\Font',
    18 => 'OC\\Preview\\MKV',
    19 => 'OC\\Preview\\MP4',
    20 => 'OC\\Preview\\AVI',
  ),
  'filesystem_check_changes' => 0,
  'filelocking.enabled' => 'true',
  'htaccess.RewriteBase' => '/',
  'integrity.check.disabled' => false,
  'knowledgebaseenabled' => false,
  'log_rotate_size' => 104857600,
  'logfile' => '/mnt/data/nextcloud.log',
  'logtimezone' => 'xxx',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'preview_max_x' => 1024,
  'preview_max_y' => 768,
  'preview_max_scale_factor' => 1,
  'redis' =>
  array (
    'host' => '/var/run/redis/redis-server.sock',
    'port' => 0,
    'timeout' => 0.0,
  ),
  'quota_include_external_storage' => false,
  'share_folder' => '/Shares',
  'skeletondirectory' => '',
  'trashbin_retention_obligation' => 'auto, 7',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'filesystem_check_changes' => 1,
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'ssl',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'xxx',
  'mail_domain' => 'xxx.xx',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtphost' => 'xxx',
  'mail_smtpauth' => 1,
  'mail_smtpport' => '465',
  'mail_smtpname' => 'xxx',
  'mail_smtppassword' => 'xxx',
  'default_phone_region' => 'xx',
  'updater.release.channel' => 'stable',
  'app_install_overwrite' =>
  array (
    0 => 'files_mindmap',
    1 => 'epubreader',
    2 => 'audioplayer',
    3 => 'podcast',
    4 => 'radio',
    5 => 'cookbook',
    6 => 'files_fulltextsearch_tesseract',
  ),
);

what’s wrong?

I have the exact same case here. I uploaded files directly into the data dir, into nextcloud (aio docker). And the scan fails for that user.

Did anyone actually resolve anything for this user?