Errors after update from 27 to 28.0.5

Nextcloud version (eg, 20.0.5): 28.0.5
Operating system and version (eg, Ubuntu 20.04): `Ubuntu 22.04.4 LTS
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.52
PHP version (eg, 7.4): 8.3

The issue you are facing:
Dear Support,
my nextcloud system worked perfectly without any error till the update.
After that i got some core error. The system seems working but i worry about it. Please help me fix them!

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

Steps to replicate it:

  1. Error every 10 min

The output of your Nextcloud log in Admin > Logging:

PASTE HERE

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

<?php
$CONFIG = array (
  'instanceid' => 'xxx',
  'passwordsalt' => 'xxx',
  'secret' => 'xxx',
  'trusted_domains' => 
  array (
    0 => 'cloud.hidrofilt.hu',
  ),
  0 => 
  array (
    0 => '127.0.0.1',
  ),
  'datadirectory' => '/var/www/html/nextcloud/data',
  'skeletondirectory' => '',
  'dbtype' => 'mysql',
  'version' => '28.0.5.1',
  'overwrite.cli.url' => 'http://127.0.0.1',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextclouduser',
  'dbpassword' => '***',
  'installed' => true,
  'default_phone_region' => 'HU',
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'ssl',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'cloud',
  'mail_domain' => 'hidrofilt.hu',
  'mail_smtphost' => '***',
  'mail_smtpport' => '465',
  'mail_smtpauth' => 1,
  'mail_smtpname' => '***',
  'mail_smtppassword' => '***',
  'maintenance' => false,
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'loglevel' => 2,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'theme' => '',
  'updater.secret' => 'xxx',
  'integrity.check.disabled' => false,
);

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

[Fri Apr 26 06:01:30.060752 2024] [authz_core:error] [pid 95699] [client 206.81.24.74:59246] AH01630: client denied by server configuration: /var/www/html/nextcloud/server-status
[Fri Apr 26 06:41:15.683405 2024] [access_compat:error] [pid 95699] [client 192.168.1.105:63183] AH01797: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata
[Fri Apr 26 06:44:09.593005 2024] [access_compat:error] [pid 123005] [client 192.168.1.105:63215] AH01797: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata
[Fri Apr 26 06:45:15.732802 2024] [access_compat:error] [pid 95699] [client 192.168.1.105:63234] AH01797: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata
[Fri Apr 26 07:40:31.950412 2024] [access_compat:error] [pid 123005] [client 192.168.1.105:63928] AH01797: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata
[Fri Apr 26 07:50:01.332827 2024] [php:warn] [pid 1421] [client 127.0.0.1:39332] PHP Warning:  http_response_code(): Cannot set response code - headers already sent (output started at /var/www/html/nextcloud/apps/richdocumentscode/proxy.php:233) in /var/www/html/nextcloud/apps/richdocumentscode/proxy.php on line 241
[Fri Apr 26 07:50:06.232423 2024] [php:warn] [pid 1423] [client 192.168.1.86:60492] PHP Warning:  http_response_code(): Cannot set response code - headers already sent (output started at /var/www/html/nextcloud/apps/richdocumentscode/proxy.php:233) in /var/www/html/nextcloud/apps/richdocumentscode/proxy.php on line 241
[Fri Apr 26 07:52:04.987899 2024] [access_compat:error] [pid 1422] [client 192.168.1.105:64045] AH01797: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata
[Fri Apr 26 07:52:52.567905 2024] [access_compat:error] [pid 1421] [client 192.168.1.105:64059] AH01797: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata
[Fri Apr 26 07:55:02.087805 2024] [php:warn] [pid 1424] [client 127.0.0.1:33028] PHP Warning:  http_response_code(): Cannot set response code - headers already sent (output started at /var/www/html/nextcloud/apps/richdocumentscode/proxy.php:233) in /var/www/html/nextcloud/apps/richdocumentscode/proxy.php on line 241
[Fri Apr 26 07:55:03.347547 2024] [php:warn] [pid 4376] [client 192.168.1.86:42324] PHP Warning:  http_response_code(): Cannot set response code - headers already sent (output started at /var/www/html/nextcloud/apps/richdocumentscode/proxy.php:233) in /var/www/html/nextcloud/apps/richdocumentscode/proxy.php on line 241
[Fri Apr 26 08:00:01.325034 2024] [php:warn] [pid 1424] [client 127.0.0.1:43194] PHP Warning:  http_response_code(): Cannot set response code - headers already sent (output started at /var/www/html/nextcloud/apps/richdocumentscode/proxy.php:233) in /var/www/html/nextcloud/apps/richdocumentscode/proxy.php on line 241
[Fri Apr 26 08:00:01.743933 2024] [php:warn] [pid 4421] [client 192.168.1.86:38440] PHP Warning:  http_response_code(): Cannot set response code - headers already sent (output started at /var/www/html/nextcloud/apps/richdocumentscode/proxy.php:233) in /var/www/html/nextcloud/apps/richdocumentscode/proxy.php on line 241

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.

TypeError
smbclient_readdir(): Argument #2 ($dir) must be of type resource, bool given
/var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php
line 150
undefinedundefinedsmbclient_readdir()
/var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeShare.php
line 94
Icewind\SMB\Native\NativeState->readdir()
/var/www/html/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php
line 256
Icewind\SMB\Native\NativeShare->dir()
/var/www/html/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php
line 651
OCA\Files_External\Lib\Storage\SMB->getFolderContents()
OCA\Files_External\Lib\Storage\SMB->getDirectoryContent()
/var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php
line 447
undefinedundefinediterator_to_array()
/var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php
line 404
OC\Files\Cache\Scanner->handleChildren()
/var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php
line 354
OC\Files\Cache\Scanner->scanChildren()
/var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php
line 577
OC\Files\Cache\Scanner->scan()
/var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php
line 589
OC\Files\Cache\Scanner->OC\Files\Cache\{closure}(
  "*** sensitive parameters replaced ***"
)
/var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php
line 576
OC\Files\Cache\Scanner->runBackgroundScanJob()
/var/www/html/nextcloud/lib/private/Files/Utils/Scanner.php
line 185
OC\Files\Cache\Scanner->backgroundScan()
/var/www/html/nextcloud/apps/files/lib/BackgroundJob/ScanFiles.php
line 76
OC\Files\Utils\Scanner->backgroundScan()
/var/www/html/nextcloud/apps/files/lib/BackgroundJob/ScanFiles.php
line 113
OCA\Files\BackgroundJob\ScanFiles->runScanner()
/var/www/html/nextcloud/lib/public/BackgroundJob/Job.php
line 81
OCA\Files\BackgroundJob\ScanFiles->run()
/var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php
line 102
OCP\BackgroundJob\Job->start()
/var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php
line 92
OCP\BackgroundJob\TimedJob->start()
/var/www/html/nextcloud/cron.php
line 152
OCP\BackgroundJob\TimedJob->execute()
Raw log entry
{
  "reqId": "i0dHTG5hv7M0wP0AxijE",
  "level": 3,
  "time": "2024-04-26T05:55:03+00:00",
  "remoteAddr": "",
  "user": "--",
  "app": "core",
  "method": "",
  "url": "--",
  "message": "Error while running background job (class: OCA\\Files\\BackgroundJob\\ScanFiles, arguments: )",
  "userAgent": "--",
  "version": "28.0.5.1",
  "exception": {
    "Exception": "TypeError",
    "Message": "smbclient_readdir(): Argument #2 ($dir) must be of type resource, bool given",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php",
        "line": 150,
        "function": "smbclient_readdir"
      },
      {
        "file": "/var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeShare.php",
        "line": 94,
        "function": "readdir",
        "class": "Icewind\\SMB\\Native\\NativeState",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php",
        "line": 256,
        "function": "dir",
        "class": "Icewind\\SMB\\Native\\NativeShare",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php",
        "line": 651,
        "function": "getFolderContents",
        "class": "OCA\\Files_External\\Lib\\Storage\\SMB",
        "type": "->"
      },
      {
        "function": "getDirectoryContent",
        "class": "OCA\\Files_External\\Lib\\Storage\\SMB",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php",
        "line": 447,
        "function": "iterator_to_array"
      },
      {
        "file": "/var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php",
        "line": 404,
        "function": "handleChildren",
        "class": "OC\\Files\\Cache\\Scanner",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php",
        "line": 354,
        "function": "scanChildren",
        "class": "OC\\Files\\Cache\\Scanner",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php",
        "line": 577,
        "function": "scan",
        "class": "OC\\Files\\Cache\\Scanner",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php",
        "line": 589,
        "function": "OC\\Files\\Cache\\{closure}",
        "class": "OC\\Files\\Cache\\Scanner",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php",
        "line": 576,
        "function": "runBackgroundScanJob",
        "class": "OC\\Files\\Cache\\Scanner",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/lib/private/Files/Utils/Scanner.php",
        "line": 185,
        "function": "backgroundScan",
        "class": "OC\\Files\\Cache\\Scanner",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/apps/files/lib/BackgroundJob/ScanFiles.php",
        "line": 76,
        "function": "backgroundScan",
        "class": "OC\\Files\\Utils\\Scanner",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/apps/files/lib/BackgroundJob/ScanFiles.php",
        "line": 113,
        "function": "runScanner",
        "class": "OCA\\Files\\BackgroundJob\\ScanFiles",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/lib/public/BackgroundJob/Job.php",
        "line": 81,
        "function": "run",
        "class": "OCA\\Files\\BackgroundJob\\ScanFiles",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php",
        "line": 102,
        "function": "start",
        "class": "OCP\\BackgroundJob\\Job",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php",
        "line": 92,
        "function": "start",
        "class": "OCP\\BackgroundJob\\TimedJob",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/cron.php",
        "line": 152,
        "function": "execute",
        "class": "OCP\\BackgroundJob\\TimedJob",
        "type": "->"
      }
    ],
    "File": "/var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php",
    "Line": 150,
    "message": "Error while running background job (class: OCA\\Files\\BackgroundJob\\ScanFiles, arguments: )",
    "exception": [],
    "CustomMessage": "Error while running background job (class: OCA\\Files\\BackgroundJob\\ScanFiles, arguments: )"
  },
  "id": "662b41c2b88a9"
}

If that was working previously, you can probably report to the bug tracker directly:

So probably some errors not caught properly. Perhaps you have a few old unused SMB storages or stuff like that?
Here you have commands to check external files:
https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html#files-external-label

faceing same behavior after upgrading from 27 → 28.
for me supesicous, the , who wants to login in the nextcloud log. same i face here. a user with – as username. this happens only on google chrome, firefox is working.
nc 28.0.4
php 8.2.18
mariadb 10.6.16