File sizes not adding up

Nextcloud version : 28.0.5
Operating system and version: Docker
Apache or nginx version: Apache 2.4.59
PHP version: 8.2.19

The issue you are facing:

I have one directory on my server where the size of the files doesn’t add up. There are two files, one is 2KB and the other 138KB. As the sum it says < 1KB and in the parent directory it shows pending as the size.

The directory is about 4 years old and the issue is there for quite some time. Meaning it has existed through a couple of updates.

I tried to fix it by running occ files:scan , but it didn’t change anything.

The directory is part of an external storage.

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

The output of your Nextcloud log in Admin > Logging:
nothing relevant

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

$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'instanceid' => 'xxx',
  'passwordsalt' => 'xxx',
  'secret' => 'xxx',
  'trusted_domains' =>
  array (
    0 => '192.168.11.3:8080',
    1 => 'cloud.domain.com',
    2 => 'app',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '28.0.5.1',
  'overwrite.cli.url' => 'https://cloud.domain.com',
  'dbname' => 'nextcloud',
  'dbhost' => 'db',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'xxx',
  'installed' => true,
  'overwriteprotocol' => 'https',
  'maintenance' => false,
  'app_install_overwrite' =>
  array (
    0 => 'files_external_gdrive',
    1 => 'documentserver_community',
  ),
  'loglevel' => 0,
  'app.mail.verify-tls-peer' => false,
  'theme' => '',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'redis',
    'password' => 'xxx',
    'port' => 6379,
  ),
  'default_phone_region' => 'DE',
  'allow_local_remote_servers' => true,
  'mail_from_address' => 'no-reply',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'domain.com',
  'mail_smtphost' => 'smtp',
  'maintenance_window_start' => 1,
);

Ownership (www user) and files access rights fit to your nextcloud instance?
e.g. www-data:www-data 755 or 770?

if so try again

occ files:scan --all

plus

occ files:scan-app-data

(optional if your files are in groupfolders)
occ groupfolders:scan

Is your nextcloud user able to write (new) files to the same folder where those mentioned files reside?