Undefined array key attributes in Samba External Folder

Hi,
Have you encountered this problem before?

Sans titre

Parser.php :

Hi @stylus,
You are missing the required support template. Please fill this form out and edit into your post.

You can also search your errors as keywords on this forum, github, and in admin documentation. Error you screencapped relates to samba and the external folders app. You can check to make sure you mounted the external location properly.

This will give us the technical info and logs needed to help you! Thanks.

I have the same issue and this seems to be an issue in icewind: Malformed state response from server · Issue #109 · icewind1991/SMB · GitHub

I’m using smbclient version 4.13.13 and it seems to work with smbclient 3.4.1, but I’m not able to downgrade the smbclient inside my docker container (based on nextcloud:24.0.1-apache).

Here is the support template

Nextcloud version (eg, 20.0.5): 24.0.1
Operating system and version (eg, Ubuntu 20.04): Ubuntu-20.04
Apache or nginx version (eg, Apache 2.4.25): 2.4.53
PHP version (eg, 7.4): 8.0.19

The issue you are facing:
Upload to an external SMB folder are not possible and fail.

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

Steps to replicate it:

  1. Build a custom Docker image with smbclient
  • The image is based on nextcloud:24.0.1-apache
  • This is how I install smbclient RUN apt-get update && apt-get install -y smbclient && rm -rf /var/lib/apt/lists
  1. Mount external storage via SMB
  2. Upload files to this directory

The output of your Nextcloud log in Admin > Logging:

Error	PHP	Error: Undefined array key "attributes" at /var/www/html/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Parser.php#155	
Fatal	webdav	Icewind\SMB\Exception\Exception: Malformed state response from server	

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

<?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  '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,
    ),
  ),
  'trusted_proxies' => 
  array (
    0 => 'XXX',
    1 => 'XXX',
  ),
  'overwritehost' => 'XXX',
  'overwriteprotocol' => 'https',
  0 => 
  array (
    'host' => 'nextcloud-redis',
    'port' => 6379,
  ),
  'instanceid' => 'XXX',
  'passwordsalt' => 'XXX',
  'secret' => 'XXX',
  'trusted_domains' => 
  array (
    0 => 'localhost:9000',
    1 => 'XXX',
  ),
  'datadirectory' => '/var/www/html/data',
  'overwrite.cli.url' => 'http://localhost:9000',
  'dbtype' => 'mysql',
  'version' => '24.0.1.1',
  'dbname' => 'XXX',
  'dbhost' => 'XXX',
  'dbport' => '',
  'dbtableprefix' => '',
  'dbuser' => 'XXX',
  'dbpassword' => 'XXX',
  'installed' => true,
  'loglevel' => 3,
  'maintenance' => false,
  'mail_smtpmode' => 'smtp',
  'mail_from_address' => 'XXX',
  'mail_domain' => 'XXX',
  'mail_smtpauthtype' => 'PLAIN',
  'mail_smtphost' => 'XXX',
  'mail_smtpport' => '587',
  'twofactor_enforced' => 'false',
  'twofactor_enforced_groups' => 
  array (
  ),
  'twofactor_enforced_excluded_groups' => 
  array (
  ),
  'theme' => '',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'XXX',
  'mail_smtppassword' => 'XXX',
  'mail_smtpsecure' => 'tls',
  'app_install_overwrite' => 
  array (
    0 => 'tasks',
    1 => 'contacts',
    2 => 'calendar',
    3 => 'user_external',
    4 => 'twofactor_admin',
    5 => 'twofactor_nextcloud_notification',
  ),
  'preview_max_x' => 200,
  'preview_max_y' => 200,
  'preview_max_scale_factor' => 1,
  'mysql.utf8mb4' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'nextcloud-redis',
    'port' => 6379,
  ),
  'updater.secret' => 'XXX',
);

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

46.5.246.124 - - [28/May/2022:21:06:22 +0000] "GET /index.php/204 HTTP/1.1" 204 1340 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.1"
46.5.246.124 - jo [28/May/2022:21:06:22 +0000] "HEAD /remote.php/dav/files/jo//Bilder/Upload/2022/05/20220522_103350.jpg HTTP/1.1" 500 540 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.1"
46.5.246.124 - jo [28/May/2022:21:06:23 +0000] "MKCOL /remote.php/dav/uploads/jo/9d3e020d2ea893b8f941c8863fe95a2a HTTP/1.1" 405 867 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.1"
46.5.246.124 - jo [28/May/2022:21:06:24 +0000] "PROPFIND /remote.php/dav/uploads/jo/9d3e020d2ea893b8f941c8863fe95a2a HTTP/1.1" 207 1186 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.1"

Output errors in nextcloud.log

{"reqId":"JmzwoSJ0oOxQzht49Lwo","level":3,"time":"2022-05-28T21:09:17+00:00","remoteAddr":"46.5.246.124","user":"jo","app":"PHP","method":"HEAD","url":"/remote.php/dav/files/jo//Bilder/Upload/2022/05/20220522_103350.jpg","message":"Undefined array key \"attributes\" at /var/www/html/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Parser.php#155","userAgent":"Mozilla/5.0 (Android) Nextcloud-android/3.20.1","version":"24.0.1.1","exception":{"Exception":"Error","Message":"Undefined array key \"attributes\" at /var/www/html/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Parser.php#155","Code":0,"Trace":[{"file":"/var/www/html/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Parser.php","line":155,"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::","args":[2,"Undefined array key \"attributes\"","/var/www/html/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Parser.php",155]},{"file":"/var/www/html/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php","line":217,"function":"parseStat","class":"Icewind\\SMB\\Wrapped\\Parser","type":"->","args":[[]]},{"file":"/var/www/html/apps/files_external/lib/Lib/Storage/SMB.php","line":193,"function":"stat","class":"Icewind\\SMB\\Wrapped\\Share","type":"->","args":["/Bilder/Upload/2022/05/20220522_103350.jpg"]},{"file":"/var/www/html/apps/files_external/lib/Lib/Storage/SMB.php","line":668,"function":"getFileInfo","class":"OCA\\Files_External\\Lib\\Storage\\SMB","type":"->","args":["/Bilder/Upload/2022/05/20220522_103350.jpg"]},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php","line":227,"function":"file_exists","class":"OCA\\Files_External\\Lib\\Storage\\SMB","type":"->","args":["Bilder/Upload/2022/05/20220522_103350.jpg"]},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Availability.php","line":244,"function":"file_exists","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->","args":["Bilder/Upload/2022/05/20220522_103350.jpg"]},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php","line":227,"function":"file_exists","class":"OC\\Files\\Storage\\Wrapper\\Availability","type":"->","args":["Bilder/Upload/2022/05/20220522_103350.jpg"]},{"file":"/var/www/html/lib/private/Files/View.php","line":1345,"function":"file_exists","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->","args":["Bilder/Upload/2022/05/20220522_103350.jpg"]},{"file":"/var/www/html/lib/private/Files/View.php","line":1390,"function":"getCacheEntry","class":"OC\\Files\\View","type":"->","args":[{"__class__":"OCA\\Files_Trashbin\\Storage","cache":{"__class__":"OC\\Files\\Cache\\Cache"},"scanner":{"__class__":"OC\\Files\\Cache\\Scanner"},"watcher":null,"propagator":null,"updater":null},"Bilder/Upload/2022/05/20220522_103350.jpg","/Bilder/Upload/2022/05/20220522_103350.jpg"]},{"file":"/var/www/html/apps/dav/lib/Connector/Sabre/Directory.php","line":231,"function":"getFileInfo","class":"OC\\Files\\View","type":"->","args":["/jo/files/Bilder/Upload/2022/05/20220522_103350.jpg"]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Tree.php","line":78,"function":"getChild","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->","args":["20220522_103350.jpg"]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":76,"function":"getNodeForPath","class":"Sabre\\DAV\\Tree","type":"->","args":["files/jo/Bilder/Upload/2022/05/20220522_103350.jpg"]},{"file":"/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpGet","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->","args":["method:GET",[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":251,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"},false]},{"file":"/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpHead","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->","args":["method:HEAD",[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/apps/dav/lib/Server.php","line":352,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/remote.php","line":166,"args":["/var/www/html/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"}}
{"reqId":"JmzwoSJ0oOxQzht49Lwo","level":4,"time":"2022-05-28T21:09:17+00:00","remoteAddr":"46.5.246.124","user":"jo","app":"webdav","method":"HEAD","url":"/remote.php/dav/files/jo//Bilder/Upload/2022/05/20220522_103350.jpg","message":"Malformed state response from server","userAgent":"Mozilla/5.0 (Android) Nextcloud-android/3.20.1","version":"24.0.1.1","exception":{"Exception":"Icewind\\SMB\\Exception\\Exception","Message":"Malformed state response from server","Code":0,"Trace":[{"file":"/var/www/html/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php","line":217,"function":"parseStat","class":"Icewind\\SMB\\Wrapped\\Parser","type":"->","args":[[]]},{"file":"/var/www/html/apps/files_external/lib/Lib/Storage/SMB.php","line":193,"function":"stat","class":"Icewind\\SMB\\Wrapped\\Share","type":"->","args":["/Bilder/Upload/2022/05/20220522_103350.jpg"]},{"file":"/var/www/html/apps/files_external/lib/Lib/Storage/SMB.php","line":668,"function":"getFileInfo","class":"OCA\\Files_External\\Lib\\Storage\\SMB","type":"->","args":["/Bilder/Upload/2022/05/20220522_103350.jpg"]},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php","line":227,"function":"file_exists","class":"OCA\\Files_External\\Lib\\Storage\\SMB","type":"->","args":["Bilder/Upload/2022/05/20220522_103350.jpg"]},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Availability.php","line":244,"function":"file_exists","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->","args":["Bilder/Upload/2022/05/20220522_103350.jpg"]},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php","line":227,"function":"file_exists","class":"OC\\Files\\Storage\\Wrapper\\Availability","type":"->","args":["Bilder/Upload/2022/05/20220522_103350.jpg"]},{"file":"/var/www/html/lib/private/Files/View.php","line":1345,"function":"file_exists","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->","args":["Bilder/Upload/2022/05/20220522_103350.jpg"]},{"file":"/var/www/html/lib/private/Files/View.php","line":1390,"function":"getCacheEntry","class":"OC\\Files\\View","type":"->","args":[{"__class__":"OCA\\Files_Trashbin\\Storage","cache":{"__class__":"OC\\Files\\Cache\\Cache"},"scanner":{"__class__":"OC\\Files\\Cache\\Scanner"},"watcher":null,"propagator":null,"updater":null},"Bilder/Upload/2022/05/20220522_103350.jpg","/Bilder/Upload/2022/05/20220522_103350.jpg"]},{"file":"/var/www/html/apps/dav/lib/Connector/Sabre/Directory.php","line":231,"function":"getFileInfo","class":"OC\\Files\\View","type":"->","args":["/jo/files/Bilder/Upload/2022/05/20220522_103350.jpg"]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Tree.php","line":78,"function":"getChild","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->","args":["20220522_103350.jpg"]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":76,"function":"getNodeForPath","class":"Sabre\\DAV\\Tree","type":"->","args":["files/jo/Bilder/Upload/2022/05/20220522_103350.jpg"]},{"file":"/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpGet","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->","args":["method:GET",[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":251,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"},false]},{"file":"/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpHead","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->","args":["method:HEAD",[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/apps/dav/lib/Server.php","line":352,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/remote.php","line":166,"args":["/var/www/html/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/html/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Parser.php","Line":157,"CustomMessage":"--"}}

Hi jd1,
I had the same problem with smbclient 4.13.17.

I was able to solve this by installing php8.0-smbclient, removing the normal smbclient from my system and restart my webserver.

1 Like