[Bug]: User username still has unscanned files after running background scan, background scan might be stopped prematurely with disabled AD-User
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
⚠️ This issue respects the following points: ⚠️
- This is a bug, not a question or a configuration/webserver/proxy issue.
- This issue is not already reported on Github OR Nextcloud Community Forum (I've searched it).
- Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- I agree to follow Nextcloud's Code of Conduct.
Bug description
This is maybe related to bug #43557
I am constantly getting warning message for one of my disabled AD users while scanning external SMB-Share:
User username still has unscanned files after running background scan, background scan might be stopped prematurely
and
InvalidArgumentException Invalid request for /myProject/Folder in apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php
And this happens multiple times per hour and spams the log.
Steps to reproduce
- Add external SMB-Share
- Save credentials for user in DB
- Scan files once successfully
- Disable user in AD and Nextcloud
Expected behavior
Do not scan files for disabled users.
Nextcloud Server version
31
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.1
Web server
Apache (supported)
Database engine version
MariaDB
Is this bug present after an update or on a fresh install?
None
Are you using the Nextcloud Server Encryption module?
None
What user-backends are you using?
- Default user-backend (database)
- LDAP/ Active Directory
- SSO - SAML
- Other
Configuration report
List of activated Apps
Nextcloud Signing status
Nextcloud Logs
{
"reqId": "uCnIU7zHEddNZfXmMHYY",
"level": 3,
"time": "2025-10-20T14:50:36+00:00",
"remoteAddr": "",
"user": "--",
"app": "files",
"method": "",
"url": "--",
"message": "Error while trying to scan mount as /00000000-0000-0000-0000-000000000001/files/smbshare/:Invalid request for /myProject/Folder (InvalidArgumentException)",
"userAgent": "--",
"version": "31.0.9.1",
"exception": {
"Exception": "Icewind\\SMB\\Exception\\InvalidArgumentException",
"Message": "Invalid request for /myProject/Folder (InvalidArgumentException)",
"Code": 22,
"Trace": [
{
"file": "/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php",
"line": 74,
"function": "fromMap",
"class": "Icewind\\SMB\\Exception\\Exception",
"type": "::"
},
{
"file": "/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php",
"line": 91,
"function": "handleError",
"class": "Icewind\\SMB\\Native\\NativeState",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php",
"line": 245,
"function": "testResult",
"class": "Icewind\\SMB\\Native\\NativeState",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeShare.php",
"line": 122,
"function": "stat",
"class": "Icewind\\SMB\\Native\\NativeState",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeFileInfo.php",
"line": 43,
"function": "rawStat",
"class": "Icewind\\SMB\\Native\\NativeShare",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeFileInfo.php",
"line": 49,
"function": "stat",
"class": "Icewind\\SMB\\Native\\NativeFileInfo",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeShare.php",
"line": 113,
"function": "getSize",
"class": "Icewind\\SMB\\Native\\NativeFileInfo",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php",
"line": 166,
"function": "stat",
"class": "Icewind\\SMB\\Native\\NativeShare",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php",
"line": 535,
"function": "getFileInfo",
"class": "OCA\\Files_External\\Lib\\Storage\\SMB",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php",
"line": 293,
"function": "getMetaData",
"class": "OCA\\Files_External\\Lib\\Storage\\SMB",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Availability.php",
"line": 238,
"function": "getMetaData",
"class": "OC\\Files\\Storage\\Wrapper\\Wrapper",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php",
"line": 293,
"function": "getMetaData",
"class": "OC\\Files\\Storage\\Wrapper\\Availability",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/Files/Cache/Scanner.php",
"line": 98,
"function": "getMetaData",
"class": "OC\\Files\\Storage\\Wrapper\\Wrapper",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/Files/Cache/Scanner.php",
"line": 139,
"function": "getData",
"class": "OC\\Files\\Cache\\Scanner",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/Files/Cache/Scanner.php",
"line": 320,
"function": "scanFile",
"class": "OC\\Files\\Cache\\Scanner",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/Files/Cache/Scanner.php",
"line": 587,
"function": "scan",
"class": "OC\\Files\\Cache\\Scanner",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/Files/Cache/Scanner.php",
"line": 599,
"function": "OC\\Files\\Cache\\{closure}",
"class": "OC\\Files\\Cache\\Scanner",
"type": "->",
"args": [
"*** sensitive parameters replaced ***"
]
},
{
"file": "/var/www/nextcloud/lib/private/Files/Cache/Scanner.php",
"line": 586,
"function": "runBackgroundScanJob",
"class": "OC\\Files\\Cache\\Scanner",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/Files/Utils/Scanner.php",
"line": 168,
"function": "backgroundScan",
"class": "OC\\Files\\Cache\\Scanner",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/files/lib/Command/Scan.php",
"line": 162,
"function": "backgroundScan",
"class": "OC\\Files\\Utils\\Scanner",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/files/lib/Command/Scan.php",
"line": 262,
"function": "scanFiles",
"class": "OCA\\Files\\Command\\Scan",
"type": "->"
},
{
"file": "/var/www/nextcloud/3rdparty/symfony/console/Command/Command.php",
"line": 326,
"function": "execute",
"class": "OCA\\Files\\Command\\Scan",
"type": "->"
},
{
"file": "/var/www/nextcloud/core/Command/Base.php",
"line": 213,
"function": "run",
"class": "Symfony\\Component\\Console\\Command\\Command",
"type": "->"
},
{
"file": "/var/www/nextcloud/3rdparty/symfony/console/Application.php",
"line": 1078,
"function": "run",
"class": "OC\\Core\\Command\\Base",
"type": "->"
},
{
"file": "/var/www/nextcloud/3rdparty/symfony/console/Application.php",
"line": 324,
"function": "doRunCommand",
"class": "Symfony\\Component\\Console\\Application",
"type": "->"
},
{
"file": "/var/www/nextcloud/3rdparty/symfony/console/Application.php",
"line": 175,
"function": "doRun",
"class": "Symfony\\Component\\Console\\Application",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/Console/Application.php",
"line": 187,
"function": "run",
"class": "Symfony\\Component\\Console\\Application",
"type": "->"
},
{
"file": "/var/www/nextcloud/console.php",
"line": 87,
"function": "run",
"class": "OC\\Console\\Application",
"type": "->"
},
{
"file": "/var/www/nextcloud/occ",
"line": 33,
"args": [
"/var/www/nextcloud/console.php"
],
"function": "require_once"
}
],
"File": "/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Exception/Exception.php",
"Line": 43,
"message": "Error while trying to scan mount as /00000000-0000-0000-0000-000000000001/files/smbshare/:Invalid request for /myProject/Folder (InvalidArgumentException)",
"exception": [],
"CustomMessage": "Error while trying to scan mount as /00000000-0000-0000-0000-000000000001/files/smbshare/:Invalid request for /myProject/Folder (InvalidArgumentException)"
},
"id": "68f64c5a637bb"
}
Additional info
The connection to the smb share fails, because the user is disabled.
Edit: Do not use this patch.
I've developed a patch to omit scans for disabled users, see attached file.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the background-scan flow in lib/private/Files/Cache/Scanner.php and apps/files/lib/Command/Scan.php, then trace external SMB handling through apps/files_external/lib/Lib/Storage/SMB.php and the NativeState.php stack-trace entry. Compare how disabled users reach the scan and verify that disabled-user mounts are skipped without leaving unscanned-file warnings or repeated SMB errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100