External storage SMB An unknown error has occurred on upload

Nextcloud version 27.0.2
Debian GNU/Linux 11 (bullseye) Linux 5.10.0-23-amd64 x86_64
nginx/1.18.0
PHP version 8.2.7

The issue you are facing:
When I upload a file to the external storage SMB that I have configured I get an unknown error and in the SMB folder I find only a .part file

Is this the first time you’ve seen this error? : YES

Steps to replicate it:

  1. Configure an external storage type SMB/CIFS following the official documentation
  2. Go to the newly created External Storage and try to upload a file
  3. the upload bar that appears in the popup fills up, gets to the end, pauses for a few seconds, and then the error “An unknown error has occurred” appears
  4. Browsing to the SMB folder from my pc I find that there is a file with the same name as the file I uploaded but with a .part extension weighing 0B

Each time in Admin → Logging these two entries appear:

[no app in context] Error: Icewind\SMB\Exception\TimedOutException: /UT/CAD/ESTERNI/BASKET/obsidian_1.4.16_amd64.deb.ocTransferId1785398946.part at <<closure>>

 0. /var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php line 75
    Icewind\SMB\Exception\Exception::fromMap()
 1. /var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php line 92
    Icewind\SMB\Native\NativeState->handleError()
 2. /var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php line 296
    Icewind\SMB\Native\NativeState->testResult()
 3. /var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeStream.php line 145
    Icewind\SMB\Native\NativeState->write()
 4. /var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeWriteStream.php line 59
    Icewind\SMB\Native\NativeStream->stream_write()
 5. /var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeWriteStream.php line 67
    Icewind\SMB\Native\NativeWriteStream->flushWrite()
 6. <<closure>>
    Icewind\SMB\Native\NativeWriteStream->stream_write()
 7. /var/www/nextcloud/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php line 59
    fwrite()
 8. /var/www/nextcloud/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php line 104
    Icewind\Streams\Wrapper->stream_write()
 9. <<closure>>
    Icewind\Streams\CallbackWrapper->stream_write()
10. /var/www/nextcloud/lib/private/legacy/OC_Helper.php line 262
    fwrite()
11. /var/www/nextcloud/lib/private/Files/Storage/Common.php line 884
    OC_Helper::streamCopy()
12. /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php line 644
    OC\Files\Storage\Common->writeStream()
13. /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php line 644
    OC\Files\Storage\Wrapper\Wrapper->writeStream()
14. /var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php line 248
    OC\Files\Storage\Wrapper\Wrapper->writeStream()
15. /var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php line 149
    OCA\DAV\Connector\Sabre\File->put()
16. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 1098
    OCA\DAV\Connector\Sabre\Directory->createFile("*** sensitive parameters replaced ***")
17. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 504
    Sabre\DAV\Server->createFile("*** sensitive parameters replaced ***")
18. /var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
    Sabre\DAV\CorePlugin->httpPut()
19. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 472
    Sabre\DAV\Server->emit()
20. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 253
    Sabre\DAV\Server->invokeMethod()
21. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 321
    Sabre\DAV\Server->start()
22. /var/www/nextcloud/apps/dav/appinfo/v1/webdav.php line 85
    Sabre\DAV\Server->exec()
23. /var/www/nextcloud/remote.php line 172
    require_once("/var/www/nextcl ... p")

PUT /remote.php/webdav/CAD_ESTERNI_BASKET/obsidian_1.4.16_amd64.deb
by tiziano at 2024-01-23T10:05:57+01:00
[webdav] Error: Icewind\SMB\Exception\FileInUseException: Invalid request for /UT/CAD/ESTERNI/BASKET/obsidian_1.4.16_amd64.deb.ocTransferId1785398946.part (FileInUseException) at <<closure>>

 0. /var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php line 75
    Icewind\SMB\Exception\Exception::fromMap()
 1. /var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php line 92
    Icewind\SMB\Native\NativeState->handleError()
 2. /var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php line 190
    Icewind\SMB\Native\NativeState->testResult()
 3. /var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeShare.php line 172
    Icewind\SMB\Native\NativeState->unlink()
 4. /var/www/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php line 426
    Icewind\SMB\Native\NativeShare->del()
 5. /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php line 265
    OCA\Files_External\Lib\Storage\SMB->unlink()
 6. /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Availability.php line 284
    OC\Files\Storage\Wrapper\Wrapper->unlink()
 7. <<closure>>
    OC\Files\Storage\Wrapper\Availability->unlink()
 8. /var/www/nextcloud/apps/files_trashbin/lib/Storage.php line 193
    call_user_func()
 9. /var/www/nextcloud/apps/files_trashbin/lib/Storage.php line 102
    OCA\Files_Trashbin\Storage->doDelete()
10. /var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php line 316
    OCA\Files_Trashbin\Storage->unlink()
11. /var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php line 149
    OCA\DAV\Connector\Sabre\File->put()
12. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 1098
    OCA\DAV\Connector\Sabre\Directory->createFile("*** sensitive parameters replaced ***")
13. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 504
    Sabre\DAV\Server->createFile("*** sensitive parameters replaced ***")
14. /var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
    Sabre\DAV\CorePlugin->httpPut()
15. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 472
    Sabre\DAV\Server->emit()
16. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 253
    Sabre\DAV\Server->invokeMethod()
17. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 321
    Sabre\DAV\Server->start()
18. /var/www/nextcloud/apps/dav/appinfo/v1/webdav.php line 85
    Sabre\DAV\Server->exec()
19. /var/www/nextcloud/remote.php line 172
    require_once("/var/www/nextcl ... p")

PUT /remote.php/webdav/CAD_ESTERNI_BASKET/obsidian_1.4.16_amd64.deb
by tiziano at 2024-01-23T10:05:58+01:00

The output of your config.php file in

<?php
$CONFIG = array (
  'instanceid' => '****************',
  'passwordsalt' => BUBUBUBUBUBUBUBUBUBUBUBU',
  'secret' => 'BABABABABABABABABABABABABA',
  'trusted_domains' => 
  array (
    0 => 'drive.pappapuppu.it',
    1 => 'turn.pappapuppu.it',
    2 => '127.0.0.1',
    3 => 'localhost',
    4 => '10.127.0.103',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '27.0.2.1',
  'overwrite.cli.url' => 'https://drive.pappapuppu.it',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '**************,
  'installed' => true,
  'logtimezone' => 'Europe/Rome',
  'default_phone_region' => 'IT',
  'default_language' => 'en',
  'default_locale' => 'it_IT',
  'knowledgebaseenabled' => false,
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'redis' => 
  array (
    'host' => 'localhost',
    'port' => 6379,
  ),
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'trusted_proxies' => 
  array (
    1 => '10.0.0.0',
    2 => '10.0.0.0',
    3 => '10.0.0.0',
    4 => 10.0.0.0',
    5 => '::1',
  ),
  'forwarded_for_headers' => 
  array (
    0 => 'HTTP_X_FORWARDED',
    1 => 'HTTP_FORWARDED_FOR',
    2 => 'HTTP_X_FORWARDED_FOR',
  ),
  'theme' => '',
  'loglevel' => 2,
  'log_type' => 'file',
  'logfile' => 'nextcloud.log',
  'logdateformat' => 'F d, Y H:i:s',
  'maintenance' => false,
  'app_install_overwrite' => 
  array (
    0 => 'external',
    1 => 'files_accesscontrol',
    2 => 'groupfolders',
    3 => 'impersonate',
    4 => 'ldap_contacts_backend',
    5 => 'spreed',
    6 => 'ldap_write_support',
    7 => 'files_downloadactivity',
    8 => 'files_trackdownloads',
    9 => 'talk_matterbridge',
    10 => 'rainloop',
    11 => 'sharelisting',
    12 => 'talked',
    13 => 'bruteforcesettings',
    14 => 'files_downloadlimit',
  ),
  'mail_from_address' => 'drive',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'papapapa.it',
  'mail_smtphost' => 'mail.pupupupu.it',
  'mail_smtpport' => '25',
  'allow_local_remote_servers' => 'true',
  'enable_previews' => true,
  'data-fingerprint' => '**********************',
  'filesystem_check_changes' => '1',
  'encryption_skip_signature_check' => true,
);