"An unknown error has occurred" when uploading to SMB external storage

Support intro

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, 12.0.2): 18.0.2
Operating system and version (eg, Ubuntu 17.04): nextcloud:fpm-alpine
Apache or nginx version (eg, Apache 2.4.25): 1.17.6
PHP version (eg, 7.1):

The issue you are facing:

I have trouble upload files to my smb external storage.

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

Y

Steps to replicate it:

  1. Goto files
  2. click on + to upload file

The output of your Nextcloud log in Admin > Logging:

{"reqId":"AgI0zCjq302tCHGIzHq3","level":4,"time":"2020-03-17T01:25:20+00:00","remoteAddr":"101.114.235.37","user":"admin","app":"webdav","method":"PUT","url":"/remote.php/webdav/SMRTR/bill/RPData_upload2.txt","message":{"Exception":"Icewind\\SMB\\Exception\\FileInUseException","Message":"Invalid request for /bill/RPData_upload2.txt.ocTransferId1219610175.part (FileInUseException)","Code":16,"Trace":[{"file":"/var/www/html/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php","line":62,"function":"fromMap","class":"Icewind\\SMB\\Exception\\Exception","type":"::","args":[{"1":"Icewind\\SMB\\Exception\\ForbiddenException","2":"Icewind\\SMB\\Exception\\NotFoundException","13":"Icewind\\SMB\\Exception\\ForbiddenException","16":"Icewind\\SMB\\Exception\\FileInUseException","17":"Icewind\\SMB\\Exception\\AlreadyExistsException","20":"Icewind\\SMB\\Exception\\InvalidTypeException","21":"Icewind\\SMB\\Exception\\InvalidTypeException","22":"Icewind\\SMB\\Exception\\InvalidArgumentException","28":"Icewind\\SMB\\Exception\\OutOfSpaceException","39":"Icewind\\SMB\\Exception\\NotEmptyException","110":"Icewind\\SMB\\Exception\\TimedOutException","111":"Icewind\\SMB\\Exception\\ConnectionRefusedException","112":"Icewind\\SMB\\Exception\\HostDownException","113":"Icewind\\SMB\\Exception\\NoRouteToHostException"},16,"/bill/RPData_upload2.txt.ocTransferId1219610175.part"]},{"file":"/var/www/html/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php","line":74,"function":"handleError","class":"Icewind\\SMB\\Native\\NativeState","type":"->","args":["/bill/RPData_upload2.txt.ocTransferId1219610175.part"]},{"file":"/var/www/html/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php","line":150,"function":"testResult","class":"Icewind\\SMB\\Native\\NativeState","type":"->","args":[false,"smb://smrtrgen20202.file.core.windows.net/smrtrfilestore01/bill/RPData_upload2.txt.ocTransferId1219610175.part"]},{"file":"/var/www/html/apps/files_external/3rdparty/icewind/smb/src/Native/NativeShare.php","line":172,"function":"unlink","class":"Icewind\\SMB\\Native\\NativeState","type":"->","args":["smb://smrtrgen20202.file.core.windows.net/smrtrfilestore01/bill/RPData_upload2.txt.ocTransferId1219610175.part"]},{"file":"/var/www/html/apps/files_external/lib/Lib/Storage/SMB.php","line":371,"function":"del","class":"Icewind\\SMB\\Native\\NativeShare","type":"->","args":["/bill/RPData_upload2.txt.ocTransferId1219610175.part"]},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php","line":266,"function":"unlink","class":"OCA\\Files_External\\Lib\\Storage\\SMB","type":"->","args":["/bill/RPData_upload2.txt.ocTransferId1219610175.part"]},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/PermissionsMask.php","line":112,"function":"unlink","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->","args":["bill/RPData_upload2.txt.ocTransferId1219610175.part"]},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php","line":266,"function":"unlink","class":"OC\\Files\\Storage\\Wrapper\\PermissionsMask","type":"->","args":["bill/RPData_upload2.txt.ocTransferId1219610175.part"]},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Availability.php","line":284,"function":"unlink","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->","args":["bill/RPData_upload2.txt.ocTransferId1219610175.part"]},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Encryption.php","line":260,"function":"unlink","class":"OC\\Files\\Storage\\Wrapper\\Availability","type":"->","args":["bill/RPData_upload2.txt.ocTransferId1219610175.part"]},{"function":"unlink","class":"OC\\Files\\Storage\\Wrapper\\Encryption","type":"->","args":["bill/RPData_upload2.txt.ocTransferId1219610175.part"]},{"file":"/var/www/html/apps/files_trashbin/lib/Storage.php","line":184,"function":"call_user_func","args":[[{"cache":null,"scanner":null,"watcher":null,"propagator":null,"updater":null,"__class__":"OC\\Files\\Storage\\Wrapper\\Encryption"},"unlink"],"bill/RPData_upload2.txt.ocTransferId1219610175.part"]},{"file":"/var/www/html/apps/files_trashbin/lib/Storage.php","line":100,"function":"doDelete","class":"OCA\\Files_Trashbin\\Storage","type":"->","args":["bill/RPData_upload2.txt.ocTransferId1219610175.part","unlink"]},{"file":"/var/www/html/custom_apps/files_accesscontrol/lib/StorageWrapper.php","line":287,"function":"unlink","class":"OCA\\Files_Trashbin\\Storage","type":"->","args":["bill/RPData_upload2.txt.ocTransferId1219610175.part"]},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php","line":266,"function":"unlink","class":"OCA\\FilesAccessControl\\StorageWrapper","type":"->","args":["bill/RPData_upload2.txt.ocTransferId1219610175.part"]},{"file":"/var/www/html/apps/dav/lib/Connector/Sabre/File.php","line":242,"function":"unlink","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->","args":["bill/RPData_upload2.txt.ocTransferId1219610175.part"]},{"file":"/var/www/html/apps/dav/lib/Connector/Sabre/Directory.php","line":156,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->","args":[null]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":1096,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->","args":["RPData_upload2.txt",null]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":525,"function":"createFile","class":"Sabre\\DAV\\Server","type":"->","args":["SMRTR/bill/RPData_upload2.txt",null,null]},{"function":"httpPut","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"absoluteUrl":"http://smrtr.australiaeast.cloudapp.azure.com/remote.php/webdav/SMRTR/bill/RPData_upload2.txt","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/3rdparty/sabre/event/lib/EventEmitterTrait.php","line":105,"function":"call_user_func_array","args":[[{"__class__":"Sabre\\DAV\\CorePlugin"},"httpPut"],[{"absoluteUrl":"http://smrtr.australiaeast.cloudapp.azure.com/remote.php/webdav/SMRTR/bill/RPData_upload2.txt","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":479,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->","args":["method:PUT",[{"absoluteUrl":"http://smrtr.australiaeast.cloudapp.azure.com/remote.php/webdav/SMRTR/bill/RPData_upload2.txt","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":254,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"absoluteUrl":"http://smrtr.australiaeast.cloudapp.azure.com/remote.php/webdav/SMRTR/bill/RPData_upload2.txt","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/apps/dav/appinfo/v1/webdav.php","line":82,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/remote.php","line":165,"args":["/var/www/html/apps/dav/appinfo/v1/webdav.php"],"function":"require_once"}],"File":"/var/www/html/apps/files_external/3rdparty/icewind/smb/src/Exception/Exception.php","Line":30,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36","version":"18.0.2.2","id":"5e70270cad57e"}

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

<?php
$CONFIG = array (
  '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' => '',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' =>
  array (
    0 => 'smrtr.australiaeast.cloudapp.azure.com',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'pgsql',
  'version' => '18.0.2.2',
  'overwrite.cli.url' => 'http://smrtr.australiaeast.cloudapp.azure.com',
  'dbname' => 'nextcloud',
  'dbhost' => 'db',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_admin',
  'dbpassword' => '',
  'installed' => true,
);

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

PASTE HERE

It has to do with encryption. After I disable encryption, I am able to upload the file successfully to azure file share. So how do I fix it if I still want to use encryption for uploading files to smb external storage.

In Google Drive is it possible to use an API and a key for encryption. Perhaps it is also possible with Azure. Google Drive only see encrypted data.

Nextcloud with Google Drive encryption (sorry in German)

Hi i get the same error, but i am using simple smb to a windows file server (php-smbclient)

I get the error messages everytime i upload a file or create a folder. But all files are uploaded and all folders are created correctly.

grafik