The error message "File with id "153131" has not been found." is encountered when executing the "occ files:transfer-ownership" command

The error message "File with id "153131" has not been found." is encountered when executing the "occ files:transfer-ownership" command.

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, 29.0.5): 29.0.2.2
Operating system and version (eg, Ubuntu 29.04): Oracle Linux Server 9.3
Apache or nginx version (eg, Apache 2.4.25): nginx/1.26.0
PHP version (eg, 8.3): 8.1.28

The issue you are facing:
When executing the “occ files:transfer-ownership” command, the error message “File with id “153131” has not been found.” occurred.

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

Steps to replicate it:

# occ files:transfer-ownership 00323401-c56f11e5-a663eb63-06a7ea03 00323401-c56f11e5-a663eb63-06a7ea02

Validating quota
Analysing files of 00323401-c56f11e5-a663eb63-06a7ea03 ...
    3 [============================]
Collecting all share information for files and folders of 00323401-c56f11e5-a663eb63-06a7ea03 ...
   46 [============================]

In View.php line 1779:
                                             
  File with id "153131" has not been found.  
                                             

files:transfer-ownership [--path PATH] [--move] [--transfer-incoming-shares [TRANSFER-INCOMING-SHARES]] [--] <source-user> <destination-user>

The output of your Nextcloud log in Admin > Logging:

NIL

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

<?php
$CONFIG = array (
  'instanceid' => '****',
  'passwordsalt' => '****',
  'secret' => '****',
  'trusted_domains' => 
  array (
    0 => '10.8.1.1',
    1 => 'x.x.x.x',
    3 => 'nextcloud.cmdschool.org',
  ),
  'datadirectory' => '/data/nextcloud-data',
  'overwritehost' => 'nextcloud.cmdschool.org',
  'overwriteprotocol' => 'https',
  'overwrite.cli.url' => 'https://nextcloud.cmdschool.org',
  'dbtype' => 'mysql',
  'version' => '29.0.2.2',
  'dbname' => 'nextcloud',
  'dbhost' => '127.0.0.1',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nextcloud',
  'dbpassword' => 'nextcloudpwd',
  'installed' => true,
  'ldapIgnoreNamingRules' => false,
  'maintenance' => false,
  'encryption.legacy_format_support' => false,
  'encryption.key_storage_migrated' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'log_type' => 'file',
  'logfile' => '/var/log/nextcloud/nextcloud.log',
  'loglevel' => 2,
  'logtimezone' => 'Asia/Shanghai',
  'log.condition' => 
  array (
    'apps' => 
    array (
      0 => 'admin_audit',
    ),
  ),
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'filelocking.enabled' => 'true',
  'redis' => 
  array (
    'host' => '127.0.0.1',
    'port' => 6379,
    'password' => 'redispasswd',
  ),
  'mail_from_address' => 'no-reply',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'cmdschool.org',
  'mysql.utf8mb4' => true,
  'mail_smtphost' => 'smtp.cmdschool.org',
  'mail_smtpport' => '25',
  'default_phone_region' => 'CN-GD',
  'user_ldap' => 
  array (
    'cleanUpJobChunkSize' => '300',
  ),
  'app_install_overwrite' => 
  array (
    0 => 'flowupload',
  ),
  'updater.secret' => '******',
);

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

NIL

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

NIL

In such a case, I would first want to find out which file it is.
Assuming you know how to talk to your database, here is the correct query to find that out:

SELECT CONCAT(oc_storages.id, oc_filecache.path) AS concatenated_path FROM oc_storages INNER JOIN oc_filecache ON oc_storages.numeric_id = oc_filecache.storage WHERE oc_filecache.fileid = 153131;

I hope this helps!


Much and good luck,
ernolf

Thank you, according to the SQL statement you provided, the query resulted in an empty result set,

MariaDB [(none)]> SELECT CONCAT(oc_storages.id, oc_filecache.path) AS concatenated_path FROM nextcloud.oc_storages 
    -> INNER JOIN nextcloud.oc_filecache 
    -> ON oc_storages.numeric_id = oc_filecache.storage 
    -> WHERE oc_filecache.fileid = 153131;
Empty set (0.000 sec)

MariaDB [(none)]>

So that’s the reason for the error message. It’s a zombie.
In such a case, I would have all files completely re-indexed so that the file cache is correct again:

occ files:scan --all

ernolf

Thank you very much, I have tried the commands you mentioned, but they did not help me fix the current issue,

occ files:scan --all
occ files:scan 00323401-c56f11e5-a663eb63-06a7ea03