# Add External Storage (SFTP) -\> Undefined array key "mtime"

**URL:** <https://help.nextcloud.com/t/add-external-storage-sftp-undefined-array-key-mtime/218293>\
**Category:** ℹ️ Support\
**Tags:** external\_storage, nc30, nas, synology, webdav\
**Created:** [February 24, 2025, 7:15pm UTC](https://help.nextcloud.com/t/add-external-storage-sftp-undefined-array-key-mtime/218293 "2025-02-24T19:15:09Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![TomW](https://help.nextcloud.com/letter_avatar/tomw/32/5_5575768a8748004e209b776fc1b2916d.png) [@TomW](https://help.nextcloud.com/u/TomW)\
**Post date:** [February 24, 2025, 7:15pm UTC](https://help.nextcloud.com/t/add-external-storage-sftp-undefined-array-key-mtime/218293/1 "2025-02-24T19:15:09Z")

</div>

> **Support intro**
>
> ## Sorry to hear you’re facing problems. 🙁
> 
> _The community help forum ([help.nextcloud.com](http://help.nextcloud.com)) is for home and non-enterprise users. Support is provided by other community members on a best effort / “as available” basis. All of those responding are **volunteering their time to help you.** _
> 
> **If you’re using Nextcloud in a business/critical setting, paid and SLA-based support services can be accessed via [portal.nextcloud.com](http://portal.nextcloud.com) where Nextcloud engineers can help ensure your business keeps running smoothly.**
> 
> ## Getting help
> 
> In order to help you as efficiently (and quickly!) as possible, please fill in as much of the below requested information as you can.
> 
> **Before clicking submit** : Please check if your query is already addressed via the following resources:
> 
> - [Official documentation](https://docs.nextcloud.com) (searchable and regularly updated)
> - [How to topics and FAQs](https://help.nextcloud.com/c/how-to-faqs/9)
> - [Forum search](https://help.nextcloud.com/search)
> 
> (Utilizing these existing resources is typically faster. It also helps reduce the load on our generous volunteers while elevating the signal to noise ratio of the forums otherwise arising from the same queries being posted repeatedly).

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. ❤

## The Basics

- Nextcloud Server version _(e.g., 29.x.x)_:
  - `30.0.6`

- Operating system and version _(e.g., Ubuntu 24.04)_:
  - `Synology DS216+`

- Web server and version _(e.g, Apache 2.4.25)_:
  - `Apache 2.4.58`

- PHP version _(e.g, 8.3)_:
  - `8.2.21`

- Is this the first time you’ve seen this error? (Yes / No):
  - `yes`

- When did this problem seem to first start?
  - `after configuration of external storage`

### Summary of the issue you are facing:

I can successfully add the external storage (green tick). But when I then try to access the files via the browser, I get the error message “This directory is not available, please check the log files or contact the administrator.”  
The following error is reported in the log file

- Error PHP   
Undefined array key “mtime” at /volume1/web/nextcloud/apps/files\_external/lib/Lib/Storage/SFTP.php#560

- Error files   
Error Call to a member function getPermissions() on array

### Steps to replicate it (hint: details matter!):

1. Configure external Storage (SFTP)

### Log entries

#### Nextcloud

```auto
Fehler	PHP	
Undefined array key "mtime" at /volume1/web/nextcloud/apps/files_external/lib/Lib/Storage/SFTP.php#560
24.02.2025, 20:07:07	
Fehler	files	
Error Call to a member function getPermissions() on array
24.02.2025, 20:07:06	
Fehler	PHP	
Undefined array key "mtime" at /volume1/web/nextcloud/apps/files_external/lib/Lib/Storage/SFTP.php#560
24.02.2025, 20:07:06	
Fehler	PHP	
Undefined array key "mtime" at /volume1/web/nextcloud/apps/files_external/lib/Lib/Storage/SFTP.php#560
24.02.2025, 19:52:54	
Fehler	webdav	
Error Call to a member function getPermissions() on array
24.02.2025, 19:52:54	
Fehler	PHP	
Undefined array key "mtime" at /volume1/web/nextcloud/apps/files_external/lib/Lib/Storage/SFTP.php#560
24.02.2025, 19:52:54	

```

### Configuration

#### Nextcloud

```auto
<?php
$CONFIG = array (
  'instanceid' => ' ****',
  'passwordsalt' => ' ****',
  'secret' => ' ****',
  'trusted_domains' => 
  array (
    0 => ' ****',
    1 => ' ****',
    2 => ' ****',
  ),
  'datadirectory' => '/volume1/nextcloud/data',
  'overwrite.cli.url' => 'http:// **** /nextcloud',
  'dbtype' => 'mysql',
  'version' => '30.0.6.2',
  'dbname' => 'nextcloud',
  'dbhost' => '127.0.0.1:3307',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_root',
  'dbpassword' => '',
  'logtimezone' => 'UTC',
  'installed' => true,
  'maintenance' => false,
  'maintenance_window_start' => '1',
  'theme' => '',
  'loglevel' => 2,
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'tls',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => '',
  'mail_domain' => '',
  'mail_smtpauth' => 1,
  'mail_smtphost' => '',
  'mail_smtpport' => '587',
  'mail_smtpname' => '',
  'mail_smtppassword' => '',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'filelocking.enabled' => true,
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'localhost',
    'port' => '6379',
    'timeout' => '0',
    'password' => '',
    'dbindex' => '0',
  ),
  'default_phone_region' => 'DE',
  'updater.release.channel' => 'stable',
  'trashbin_retention_obligation' => '30,60',
  'mysql.utf8mb4' => true,
  'preview_max_memory' => 128,
  'simpleSignUpLink.shown' => false,
  'app_install_overwrite' => 
  array (
    0 => 'calendar',
    1 => 'files_texteditor',
  ),
  'forbidden_filename_basenames' => 
  array (
    0 => 'con',
    1 => 'prn',
    2 => 'aux',
    3 => 'nul',
    4 => 'com0',
    5 => 'com1',
    6 => 'com2',
    7 => 'com3',
    8 => 'com4',
    9 => 'com5',
    10 => 'com6',
    11 => 'com7',
    12 => 'com8',
    13 => 'com9',
    14 => 'com¹',
    15 => 'com²',
    16 => 'com³',
    17 => 'lpt0',
    18 => 'lpt1',
    19 => 'lpt2',
    20 => 'lpt3',
    21 => 'lpt4',
    22 => 'lpt5',
    23 => 'lpt6',
    24 => 'lpt7',
    25 => 'lpt8',
    26 => 'lpt9',
    27 => 'lpt¹',
    28 => 'lpt²',
    29 => 'lpt³',
  ),
  'forbidden_filename_characters' => 
  array (
    0 => '<',
    1 => '>',
    2 => ':',
    3 => '"',
    4 => '|',
    5 => '?',
    6 => '*',
    7 => '\\',
    8 => '/',
  ),
  'forbidden_filename_extensions' => 
  array (
    0 => ' ',
    1 => '.',
    2 => '.filepart',
    3 => '.part',
  ),
);

```

Is this a bug?

---

<div class="post-metadata">

**Author:** ![TomW](https://help.nextcloud.com/letter_avatar/tomw/32/5_5575768a8748004e209b776fc1b2916d.png) [@TomW](https://help.nextcloud.com/u/TomW)\
**Post date:** [February 28, 2025, 10:12am UTC](https://help.nextcloud.com/t/add-external-storage-sftp-undefined-array-key-mtime/218293/2 "2025-02-28T10:12:44Z")

</div>

Can’t anyone here help me?  
Can someone perhaps recreate the problem?

---

<div class="post-metadata">

**Author:** ![TomW](https://help.nextcloud.com/letter_avatar/tomw/32/5_5575768a8748004e209b776fc1b2916d.png) [@TomW](https://help.nextcloud.com/u/TomW)\
**Post date:** [March 5, 2025, 8:04pm UTC](https://help.nextcloud.com/t/add-external-storage-sftp-undefined-array-key-mtime/218293/3 "2025-03-05T20:04:44Z")

</div>

I don’t know if that is relevant. When I run an “occ files:scan --all”, I get these error messages for the user who is enabled for the external storage.

> Blockzitat  
> Starting scan for user 9 out of 12 (root)  
> Error during scan: Undefined array key “mtime”  
> Error during scan: Undefined array key “mtime”  
> Exception during scan: Parent folder not in filecache for docker  
> #0 /volume1/web/nextcloud/lib/private/Files/Cache/Wrapper/CacheWrapper.php(129):OC\Files\Cache\Cache-\>insert(‘docker’, Array)  
> #1 /volume1/web/nextcloud/lib/private/Files/Cache/Scanner.php(284): OC\Files\Cache\Wrapper\CacheWrapper-\>insert(‘docker’, Array)  
> #2 /volume1/web/nextcloud/lib/private/Files/Cache/Scanner.php(217): OC\Files\Cache\Scanner-\>addToCache(‘docker’, Array, -1)  
> #3 /volume1/web/nextcloud/lib/private/Files/Cache/Scanner.php(501): OC\Files\Cache\Scanner-\>scanFile(‘docker’, 3, -1, false, true, Array)  
> #4 /volume1/web/nextcloud/lib/private/Files/Cache/Scanner.php(425): OC\Files\Cache\Scanner-\>handleChildren(‘’, true, 3, -1, true, 0, false)  
> #5 /volume1/web/nextcloud/lib/private/Files/Cache/Scanner.php(331): OC\Files\Cache\Scanner-\>scanChildren(‘’, true, 3, -1, true, -1)  
> #6 /volume1/web/nextcloud/lib/private/Files/Utils/Scanner.php(262): OC\Files\Cache\Scanner-\>scan(‘’, true, 3)  
> #7 /volume1/web/nextcloud/apps/files/lib/Command/Scan.php(153): OC\Files\Utils\Scanner-\>scan(‘/root’, true, NULL)  
> #8 /volume1/web/nextcloud/apps/files/lib/Command/Scan.php(214): OCA\Files\Command\Scan-\>scanFiles(‘root’, ‘/root’, NULL, Object(Symfony\Component\Console\Output \ConsoleOutput), false, true, false)  
> #9 /volume1/web/nextcloud/3rdparty/symfony/console/Command/Command.php(326): OCA\Files\Command\Scan-\>execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))  
> #10 /volume1/web/nextcloud/core/Command/Base.php(161): Symfony\Component\Console\Command\Command-\>run(Object(Symfony\Component\Console\Input\ArgvInput), Object( Symfony\Component\Console\Output\ConsoleOutput))  
> #11 /volume1/web/nextcloud/3rdparty/symfony/console/Application.php(1078): OC\Core\Command\Base-\>run(Object(Symfony\Component\Console\Input\ArgvInput), Object(S ymfony\Component\Console\Output\ConsoleOutput))  
> #12 /volume1/web/nextcloud/3rdparty/symfony/console/Application.php(324): Symfony\Component\Console\Application-\>doRunCommand(Object(OCA\Files\Command\Scan), Ob ject(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Consol e\Output\ConsoleOutput))  
> #13 /volume1/web/nextcloud/3rdparty/symfony/console/Application.php(175): Symfony\Component\Console\Application-\>doRun(Object(Symfony\Component\Console\Input\Ar gvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))  
> #14 /volume1/web/nextcloud/lib/private/Console/Application.php(183): Symfony\Component\Console\Application-\>run(Object(Symfony\Component\Console\Input\ArgvInput ), Object(Symfony\Component\Console\Output\ConsoleOutput))  
> #15 /volume1/web/nextcloud/console.php(87): OC\Console\Application-\>run(Object(Symfony\Component\Console\Input\ArgvInput))  
> #16 /volume1/web/nextcloud/occ(11): require\_once(‘/volume1/web/ne…’)  
> #17 {main}

---

<div class="post-metadata">

**Author:** ![veilnix](https://help.nextcloud.com/letter_avatar/veilnix/32/5_5575768a8748004e209b776fc1b2916d.png) [@veilnix](https://help.nextcloud.com/u/veilnix)\
**Post date:** [April 1, 2025, 6:59am UTC](https://help.nextcloud.com/t/add-external-storage-sftp-undefined-array-key-mtime/218293/4 "2025-04-01T06:59:34Z")

</div>

Unfortunately I’ve got the same issue with my Synology NAS. Apperantly it’s currently causing a bug in Nextcloud.

My summary:  
I want to integrate my NAS as external storage via SFTP.  
My tests via the public DDNS are all successful, but  
it fails when integrating with Nextcloud. No error message is displayed, but afterwards, no files can be shown in the Files app (“This directory is not available, please check the log files or contact the administrator.”). When I try to open the external storage, the following error message appears:  
‘Error mounting external storage  
An error occurred with this external storage. Would you like to check the mount point configuration on the settings page?’

Unfortunately, the error message is quite vague, and the settings seem correct from my perspective.

I’m using the same login credentials, so it doesn’t make sense to me.

---

<div class="post-metadata">

**Author:** ![TomW](https://help.nextcloud.com/letter_avatar/tomw/32/5_5575768a8748004e209b776fc1b2916d.png) [@TomW](https://help.nextcloud.com/u/TomW)\
**Post date:** [April 2, 2025, 8:00pm UTC](https://help.nextcloud.com/t/add-external-storage-sftp-undefined-array-key-mtime/218293/5 "2025-04-02T20:00:25Z")

</div>

Unfortunately, I have not yet found a solution.  
The problem has been marked as already solved here. But apparently the problem still exists.

> <https://github.com/nextcloud/server/issues/31860>
>
> \### ⚠️ This issue respects the following points: ⚠️
> 
> \- \[X\] This is a \*\*bug\*\*, …not a question or a configuration/webserver/proxy issue.
> \- \[X\] This issue is \*\*not\*\* already reported on Github \_(I've searched it)\_.
> \- \[X\] Nextcloud Server \*\*is\*\* up to date. See \[Maintenance and Release Schedule\](https://github.com/nextcloud/server/wiki/Maintenance-and-Release-Schedule) for supported versions.
> \- \[X\] I agree to follow Nextcloud's \[Code of Conduct\](https://nextcloud.com/contribute/code-of-conduct/).
> 
> \### Bug description
> 
> Error: Undefined array key "size" at /var/www/nextcloud/apps/files\_external/lib/Lib/Storage/SFTP.php#460
> 
> Error: Undefined array key "mtime" at /var/www/nextcloud/apps/files\_external/lib/Lib/Storage/SFTP.php#459
> 
> \### Steps to reproduce
> 
> 1.Added SFTP External Site
> 2.
> 3.
> 
> 
> \### Expected behavior
> 
> NA
> 
> \### Installation method
> 
> Manual installation
> 
> \### Operating system
> 
> Debian/Ubuntu
> 
> \### PHP engine version
> 
> PHP 8.0
> 
> \### Web server
> 
> Apache (supported)
> 
> \### Database engine version
> 
> MariaDB
> 
> \### Is this bug present after an update or on a fresh install?
> 
> Fresh Nextcloud Server install
> 
> \### Are you using the Nextcloud Server Encryption module?
> 
> Encryption is Disabled
> 
> \### What user-backends are you using?
> 
> \- \[X\] Default user-backend \_(database)\_
> \- \[X\] LDAP/ Active Directory
> \- \[\] SSO - SAML
> \- \[\] Other
> 
> \### Configuration report
> 
> \`\`\`shell
> {
> "system": {
> "instanceid": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "passwordsalt": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "secret": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "trusted\_domains": \[
> "cloud.next.org"
> \],
> "datadirectory": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "dbtype": "mysql",
> "version": "23.0.3.2",
> "overwrite.cli.url": "https:\\/\\/cloud.next.org",
> "htaccess.RewriteBase": "\\/",
> "dbname": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "dbhost": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "dbport": "",
> "dbtableprefix": "oc\_",
> "mysql.utf8mb4": true,
> "dbuser": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "dbpassword": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "installed": true,
> "memcache.local": "\\\\OC\\\\Memcache\\\\APCu",
> "memcache.distributed": "\\\\OC\\\\Memcache\\\\Redis",
> "memcache.locking": "\\\\OC\\\\Memcache\\\\Redis",
> "redis": {
> "host": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "port": 6379
> },
> "default\_phone\_region": "US",
> "mail\_from\_address": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "mail\_smtpmode": "smtp",
> "mail\_sendmailmode": "smtp",
> "mail\_domain": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "mail\_smtphost": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "mail\_smtpport": "25",
> "skeletondirectory": "\\/var\\/skeleton",
> "simpleSignUpLink.shown": false,
> "trashbin\_retention\_obligation": "auto,30",
> "versions\_retention\_obligation": "auto,1",
> "allow\_local\_remote\_servers": true,
> "preview\_max\_memory": 1280,
> "ldapProviderFactory": "OCA\\\\User\_LDAP\\\\LDAPProviderFactory",
> "twofactor\_enforced": "true",
> "twofactor\_enforced\_groups": \[\],
> "twofactor\_enforced\_excluded\_groups": \[\]
> }
> }
> \`\`\`
> 
> 
> \### List of activated Apps
> 
> \`\`\`shell
> \- accessibility: 1.9.0
> - activity: 2.15.0
> - admin\_audit: 1.13.0
> - bruteforcesettings: 2.3.0
> - circles: 23.1.0
> - cloud\_federation\_api: 1.6.0
> - comments: 1.13.0
> - contactsinteraction: 1.4.0
> - dashboard: 7.3.0
> - dav: 1.21.0
> - federatedfilesharing: 1.13.0
> - federation: 1.13.0
> - files: 1.18.0
> - files\_external: 1.15.0
> - files\_pdfviewer: 2.4.0
> - files\_rightclick: 1.2.0
> - files\_sharing: 1.15.0
> - files\_trashbin: 1.13.0
> - files\_versions: 1.16.0
> - files\_videoplayer: 1.12.0
> - firstrunwizard: 2.12.0
> - groupfolders: 11.1.2
> - impersonate: 1.10.0
> - logreader: 2.8.0
> - lookup\_server\_connector: 1.11.0
> - nextcloud\_announcements: 1.12.0
> - notifications: 2.11.1
> - oauth2: 1.11.0
> - officeonline: 1.1.3
> - password\_policy: 1.13.0
> - photos: 1.5.0
> - privacy: 1.7.0
> - provisioning\_api: 1.13.0
> - recommendations: 1.2.0
> - serverinfo: 1.13.0
> - settings: 1.5.0
> - sharebymail: 1.13.0
> - spreed: 13.0.4
> - support: 1.6.0
> - survey\_client: 1.11.0
> - suspicious\_login: 4.1.0
> - systemtags: 1.13.0
> - text: 3.4.1
> - theming: 1.14.0
> - twofactor\_admin: 3.2.0
> - twofactor\_backupcodes: 1.12.0
> - twofactor\_email: 2.1.1
> - twofactor\_totp: 6.2.0
> - updatenotification: 1.13.0
> - user\_ldap: 1.13.1
> - user\_status: 1.3.1
> - viewer: 1.7.0
> - weather\_status: 1.3.0
> - workflowengine: 2.5.0
> Disabled:
> - encryption
> \`\`\`
> 
> 
> \### Nextcloud Signing status
> 
> \_No response\_
> 
> \### Nextcloud Logs
> 
> \`\`\`shell
> {"reqId":"BMhVIkiOx1MPhIESPwYr","level":3,"time":"2022-04-06T14:47:46+00:00","remoteAddr":"10.0.10.99","user":"ax","app":"PHP","method":"GET","url":"/index.php/apps/files/ajax/download.php?dir=%2FAviat%20FTP%2FProVision&files=GA\_releases&downloadStartSecret=f5h567ouluu","message":"Undefined array key \\"size\\" at /var/www/nextcloud/apps/files\_external/lib/Lib/Storage/SFTP.php#460","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36","version":"23.0.3.2","exception":{"Exception":"Error","Message":"Undefined array key \\"size\\" at /var/www/nextcloud/apps/files\_external/lib/Lib/Storage/SFTP.php#460","Code":0,"Trace":\[{"file":"/var/www/nextcloud/apps/files\_external/lib/Lib/Storage/SFTP.php","line":460,"function":"onError","class":"OC\\\\Log\\\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/Common.php","line":187,"function":"stat","class":"OCA\\\\Files\_External\\\\Lib\\\\Storage\\\\SFTP","type":"-\>"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/Common.php","line":331,"function":"filemtime","class":"OC\\\\Files\\\\Storage\\\\Common","type":"-\>"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php","line":381,"function":"hasUpdated","class":"OC\\\\Files\\\\Storage\\\\Common","type":"-\>"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php","line":381,"function":"hasUpdated","class":"OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper","type":"-\>"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Availability.php","line":386,"function":"hasUpdated","class":"OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper","type":"-\>"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php","line":381,"function":"hasUpdated","class":"OC\\\\Files\\\\Storage\\\\Wrapper\\\\Availability","type":"-\>"},{"file":"/var/www/nextcloud/lib/private/Files/Cache/Watcher.php","line":134,"function":"hasUpdated","class":"OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper","type":"-\>"},{"file":"/var/www/nextcloud/lib/private/Files/View.php","line":1351,"function":"needsUpdate","class":"OC\\\\Files\\\\Cache\\\\Watcher","type":"-\>"},{"file":"/var/www/nextcloud/lib/private/Files/View.php","line":1454,"function":"getCacheEntry","class":"OC\\\\Files\\\\View","type":"-\>"},{"file":"/var/www/nextcloud/lib/private/legacy/OC\_Files.php","line":373,"function":"getDirectoryContent","class":"OC\\\\Files\\\\View","type":"-\>"},{"file":"/var/www/nextcloud/lib/private/legacy/OC\_Files.php","line":161,"function":"getNumberOfFiles","class":"OC\_Files","type":"::"},{"file":"/var/www/nextcloud/apps/files/ajax/download.php","line":77,"function":"get","class":"OC\_Files","type":"::"},{"file":"/var/www/nextcloud/lib/private/Route/Route.php","line":155,"args":\["/var/www/nextcloud/apps/files/ajax/download.php"\],"function":"require\_once"},{"function":"OC\\\\Route\\\\{closure}","class":"OC\\\\Route\\\\Route","type":"-\>","args":\["\*\*\* sensitive parameters replaced \*\*\*"\]},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":310,"function":"call\_user\_func"},{"file":"/var/www/nextcloud/lib/base.php","line":1006,"function":"match","class":"OC\\\\Route\\\\Router","type":"-\>"},{"file":"/var/www/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}\],"File":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"id":"624da87e5ee0d"}
> \`\`\`
> 
> 
> \### Additional info
> 
> \_No response\_

> <https://github.com/nextcloud/server/issues/25788>
>
> \### Steps to reproduce
> 1. Setup external storage SFTP
> 2. Check Connection
> 3. …Open external storage
> 4. Upload File with size larger than 524.888 bytes
> 5. Try download the file
> \<img width="822" alt="image" src="https://user-images.githubusercontent.com/79477404/109046488-16596100-76d5-11eb-9c73-337dd9ecdb17.png"\>
> 
> \### Expected behaviour
> 1. Setup external storage SFTP
> 2. Check Connection
> 3. Open external storage
> 4. Upload File with size larger than 524.888 bytes
> 5. Download the file
> 
> \### Actual behaviour
> 1. Setup external storage SFTP
> 2. Check Connection
> 3. Open external storage
> 4. Upload File with size larger than 524.888 bytes
> 5. Try to download file
> 6. Error Page Displayed
> \<img width="858" alt="image" src="https://user-images.githubusercontent.com/79477404/109046080-a4811780-76d4-11eb-8e49-b69f751837ae.png"\>
> 
> \### Server configuration
> 
> \*\*Operating system: Linux 3.10.0-1160.6.1.el7.x86\_64 x86\_64
> 
> \*\*Web server:
> 
> \*\*Database: Type: mysql Version: 10.3.25 
> \*\*PHP version: PHP Version 7.4.15
> 
> \*\*Nextcloud version: Nextcloud 20.0.7
> 
> \*\*Updated from an older Nextcloud/ownCloud or fresh install: Updated from previous stable version
> 
> \*\*Where did you install Nextcloud from: 
> 
> \*\*Signing status:\*\*
> \<details\>
> \<summary\>Signing status\</summary\>
> No errors have been found.
> \</details\>
> 
> \*\*List of activated apps:\*\*
> \<details\>
> \<summary\>Activated Apps\</summary\>
> Accessibility 1.6.0
> Activity 2.13.4
> Brute-force settings 2.0.1
> Calendar 2.1.3
> Collaborative tags 1.10.0
> Comments 1.10.0
> Community Document Server 0.1.9
> Contacts 3.4.3
> Contacts Interaction 1.1.0
> Dashboard 7.0.0
> Default encryption module 2.8.1
> Deleted files 1.10.1
> Element for Nextcloud 0.7.2
> End-to-End Encryption 1.6.2
> EPUB/CBZ/PDF ebook reader 1.4.5
> External storage support 1.11.1
> External Storage: OneDrive 1.1.0
> Extract 1.3.0
> Federation 1.10.1
> File sharing 1.12.2
> First run wizard 2.9.0
> Group folders 8.2.0
> Log Reader 2.5.0
> Maps 0.1.8
> Monitoring 1.10.0
> Nextcloud announcements 1.9.0
> Notifications 2.8.0
> Password policy 1.10.1
> Passwords 2021.2.0
> PDF viewer 2.0.1
> Photos 1.2.3
> Privacy 1.4.0
> Ransomware protection 1.8.0
> Recommendations 0.8.0
> Right click 0.17.0
> Share by mail 1.10.0
> Support 1.3.0
> Talk 10.0.6
> Tasks 0.13.6
> Text 3.1.0
> Theming 1.11.0
> Update notification 1.10.0
> Usage survey 1.8.0
> User status 1.0.1
> Versions 1.13.0
> Video player 1.9.0
> Weather status 1.0.0
> 
> 
> \</details\>
> 
> \*\*Nextcloud configuration:\*\*
> \<details\>
> \<summary\>Nextcloud configuration \</summary\>
> {
> "system": {
> "instanceid": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "passwordsalt": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "secret": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "trusted\_domains": \[
> "www.webserver.cloud"
> \],
> "datadirectory": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "dbtype": "mysql",
> "version": "20.0.7.1",
> "overwrite.cli.url": "https:\\/\\/www.webserver.cloud",
> "dbname": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "dbhost": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "dbport": "",
> "dbtableprefix": "oc\_",
> "mysql.utf8mb4": true,
> "dbuser": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "dbpassword": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "installed": true,
> "mail\_smtpmode": "sendmail",
> "mail\_smtpsecure": "tls",
> "mail\_sendmailmode": "pipe",
> "mail\_from\_address": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "mail\_domain": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "mail\_smtpauthtype": "LOGIN",
> "mail\_smtpport": "587",
> "mail\_smtphost": "\*\*\*REMOVED SENSITIVE VALUE\*\*\*",
> "memcache.local": "\\\\OC\\\\Memcache\\\\APCu",
> "maintenance": false,
> "loglevel": 2,
> "theme": "",
> "enable\_certificate\_management": true
> }
> }
> 
> \</details\>
> 
> \*\*Are you using external storage, if yes which one: SFTP, WebDAV
> 
> \*\*Are you using encryption:\*\* yes on WebDav, no on SFTP
> 
> \*\*Are you using an external user-backend, if yes which one:\*\* No
> 
> 
> \### Client configuration
> \*\*Browser: Safari, Firefox
> 
> \*\*Operating system:OS X 10.14.6, 10.15.7, Windows 7, Windows 10
> 
> \### Logs
> 
> 
> 
> \#### Web server error log
> \<details\>
> \<summary\>\</summary\>
> 
> 
> \</details\>
> 
> \#### Nextcloud log (data/nextcloud.log)
> \<details\>
> \<summary\>Nextcloud log\</summary\>
> 
> \[PHP\] Error: Error: fopen(sftpread://NextcloudExternal/\_Shared\_Remote/PhotoArchiv/Peter/DSC\_0007.JPG): failed to open stream: &quot;OCA\\Files\_External\\Lib\\Storage\\SFTPReadStream::stream\_open&quot; call failed at /var/www/virtual/webserver/www.webserver.cloud/apps/files\_external/lib/Lib/Storage/SFTP.php#378 at \<\<closure\>\>
> 
> 0. \<\<closure\>\>
> OC\\Log\\ErrorHandler::onError(2, "fopen(sftpread: ... d", "/var/www/virtua ... p", 378, {path: "Nextclou ... l})
> 1. /var/www/virtual/webserver/www.webserver.cloud/apps/files\_external/lib/Lib/Storage/SFTP.php line 378
> fopen("sftpread://Next ... G", "r", false, null)
> 2. /var/www/virtual/webserver/www.webserver.cloud/lib/private/Files/Storage/Wrapper/Wrapper.php line 300
> OCA\\Files\_External\\Lib\\Storage\\SFTP-\>fopen("NextcloudExtern ... G", "r")
> 3. /var/www/virtual/webserver/www.webserver.cloud/lib/private/Files/Storage/Wrapper/Availability.php line 315
> OC\\Files\\Storage\\Wrapper\\Wrapper-\>fopen("NextcloudExtern ... G", "r")
> 4. /var/www/virtual/webserver/www.webserver.cloud/lib/private/Files/Storage/Wrapper/Encryption.php line 480
> OC\\Files\\Storage\\Wrapper\\Availability-\>fopen("NextcloudExtern ... G", "r")
> 5. /var/www/virtual/webserver/www.webserver.cloud/lib/private/Files/Storage/Wrapper/Wrapper.php line 300
> OC\\Files\\Storage\\Wrapper\\Encryption-\>fopen("NextcloudExtern ... G", "r")
> 6. /var/www/virtual/webserver/www.webserver.cloud/lib/private/Files/View.php line 1165
> OC\\Files\\Storage\\Wrapper\\Wrapper-\>fopen("NextcloudExtern ... G", "r")
> 7. /var/www/virtual/webserver/www.webserver.cloud/lib/private/Files/View.php line 1001
> OC\\Files\\View-\>basicOperation("fopen", "/webserver\_cloud ... G", \["read"\], "r")
> 8. /var/www/virtual/webserver/www.webserver.cloud/lib/private/Files/Node/File.php line 115
> OC\\Files\\View-\>fopen("/webserver\_cloud ... G", "r")
> 9. /var/www/virtual/webserver/www.webserver.cloud/lib/private/Preview/ProviderV2.php line 86
> OC\\Files\\Node\\File-\>fopen("r")
> 10. /var/www/virtual/webserver/www.webserver.cloud/lib/private/Preview/Image.php line 50
> OC\\Preview\\ProviderV2-\>getLocalFile(OC\\Files\\Node\\File {})
> 11. /var/www/virtual/webserver/www.webserver.cloud/lib/private/Preview/GeneratorHelper.php line 63
> OC\\Preview\\Image-\>getThumbnail(OC\\Files\\Node\\File {}, 4096, 4096)
> 12. /var/www/virtual/webserver/www.webserver.cloud/lib/private/Preview/Generator.php line 244
> OC\\Preview\\GeneratorHelper-\>getThumbnail(OC\\Preview\\JPEG {}, OC\\Files\\Node\\File {}, 4096, 4096)
> 13. /var/www/virtual/webserver/www.webserver.cloud/lib/private/Preview/Generator.php line 140
> OC\\Preview\\Generator-\>getMaxPreview(OC\\Files\\SimpleFS\\SimpleFolder {}, OC\\Files\\Node\\File {}, "image/jpeg", "")
> 14. /var/www/virtual/webserver/www.webserver.cloud/lib/private/Preview/Generator.php line 109
> OC\\Preview\\Generator-\>generatePreviews(OC\\Files\\Node\\File {}, \[{width: 32,heig ... }\], "image/jpeg")
> 15. /var/www/virtual/webserver/www.webserver.cloud/lib/private/PreviewManager.php line 190
> OC\\Preview\\Generator-\>getPreview(OC\\Files\\Node\\File {}, 32, 32, true, "fill", null)
> 16. /var/www/virtual/webserver/www.webserver.cloud/core/Controller/PreviewController.php line 170
> OC\\PreviewManager-\>getPreview(OC\\Files\\Node\\File {}, 32, 32, true, "fill")
> 17. /var/www/virtual/webserver/www.webserver.cloud/core/Controller/PreviewController.php line 143
> OC\\Core\\Controller\\PreviewController-\>fetchPreview(OC\\Files\\Node\\File {}, 32, 32, false, true, "fill")
> 18. /var/www/virtual/webserver/www.webserver.cloud/lib/private/AppFramework/Http/Dispatcher.php line 169
> OC\\Core\\Controller\\PreviewController-\>getPreviewByFileId(38764, 32, 32, false, true, "fill")
> 19. /var/www/virtual/webserver/www.webserver.cloud/lib/private/AppFramework/Http/Dispatcher.php line 100
> OC\\AppFramework\\Http\\Dispatcher-\>executeController(OC\\Core\\Controller\\PreviewController {}, "getPreviewByFileId")
> 20. /var/www/virtual/webserver/www.webserver.cloud/lib/private/AppFramework/App.php line 152
> OC\\AppFramework\\Http\\Dispatcher-\>dispatch(OC\\Core\\Controller\\PreviewController {}, "getPreviewByFileId")
> 21. /var/www/virtual/webserver/www.webserver.cloud/lib/private/Route/Router.php line 309
> OC\\AppFramework\\App::main("OC\\\\Core\\\\Controller\\\\PreviewController", "getPreviewByFileId", OC\\AppFramework\\ ... {}, {\_route: "core.P ... "})
> 22. /var/www/virtual/webserver/www.webserver.cloud/lib/base.php line 1008
> OC\\Route\\Router-\>match("/core/preview")
> 23. /var/www/virtual/webserver/www.webserver.cloud/index.php line 37
> OC::handleRequest()
> 
> GET /index.php/core/preview?fileId=38764&x=32&y=32
> from 91.56.150.220 by webserver\_cloud at 2021-02-24T18:51:32+00:00
> \</details\>
> 
> \#### SFTP Server Side Log
> \<details\>
> \<summary\>SSH Server Side log\</summary\>
> 
> 
> \<session id="9915" service="SSH" remoteAddress=«xxx.xxx.xxx.xxx:yyyyy» virtualAccount=«Name» windowsAccount=«NameW»/\>
> \<channel type="session" id="1"/\>
> \<sfs moduleName="FlowSfsWin" mountPath="/NextcloudExternal" code="90000" desc="Transferring file ended."\>
> \<parameters path="F:\\\_remote\_nextcloud\\\_Shared\_Remote\\PhotoArchiv\\Peter\\DSC\_0007.JPG" timeMs="238" bytesRead="524288" bytesWritten="0" readRangeOffset="0" readRangeLength="524288" writeRangeOffset="0" writeRangeLength="0" createdNewFile="false" resizedFile="false" endedBy="Client"/\>
> \<help message="File transfer ended by client."/\>
> \</sfs\>
> \</event\>
> 
> \</details\>
> 
> 
> \### Additional Information
> The closed issue https://github.com/nextcloud/server/issues/20979 referred to changes in apps/files\_external/lib/Lib/Storage/SFT.php. Editing the SFTP.php file to remove the special cases for read/write fixes the problem. However chunk size for transfer via SFTP is then limited to 8192bytes resulting in numerous connection attempts via SFTP to the server. Changing the definitions request\_chunk(256 \* 1024) setting in apps/files\_external/lib/Lib/Storage/SFTPReadStream.php enlarges the chunk size but does not fix the problem.

---

<div class="post-metadata">

**Author:** ![TomW](https://help.nextcloud.com/letter_avatar/tomw/32/5_5575768a8748004e209b776fc1b2916d.png) [@TomW](https://help.nextcloud.com/u/TomW)\
**Post date:** [June 1, 2025, 11:43am UTC](https://help.nextcloud.com/t/add-external-storage-sftp-undefined-array-key-mtime/218293/6 "2025-06-01T11:43:31Z")

</div>

The problem still exists with the latest version of Nextcloud (31.0.5).  
Does no one have a solution to the problem?

The external storage is shown as correctly integrated, but then Nextcloud folder not found is written under External storage.

 ![Screenshot 2025-06-01 134137](https://help.nextcloud.com/uploads/default/original/3X/2/e/2e7360086722d367d30e5b073dd0af6e8faab7f3.jpeg)  
 ![Screenshot 2025-06-01 134315](https://help.nextcloud.com/uploads/default/original/3X/e/3/e39c4e6e57fec2077fa6342b8e3b1297494f019b.jpeg)

---

<div class="post-metadata">

**Author:** ![TomW](https://help.nextcloud.com/letter_avatar/tomw/32/5_5575768a8748004e209b776fc1b2916d.png) [@TomW](https://help.nextcloud.com/u/TomW)\
**Post date:** [June 26, 2025, 7:16pm UTC](https://help.nextcloud.com/t/add-external-storage-sftp-undefined-array-key-mtime/218293/7 "2025-06-26T19:16:06Z")

</div>

The problem still exists with the latest version of Nextcloud (31.0.6).  
I have now change to FTP (FTPS) and now it works.  
Why does not work with SFTP to don`t know.

Should I create a Bugreport on Github or is this thread enough?

---

<div class="post-metadata">

**Author:** ![scubamuc](https://help.nextcloud.com/user_avatar/help.nextcloud.com/scubamuc/32/63165_2.png) [@scubamuc](https://help.nextcloud.com/u/scubamuc)\
**Post date:** [June 27, 2025, 1:03pm UTC](https://help.nextcloud.com/t/add-external-storage-sftp-undefined-array-key-mtime/218293/8 "2025-06-27T13:03:16Z")

</div>

> [@TomW](#):
>
> Does no one have a solution to the problem?

maybe workaround?..

- mount your DS into the host via `fstab` and then connect locally via external storage,
- see [NC, die auf einem ThinkCentre läuft, mit Synology NAS per SFTP verbinden](https://help.nextcloud.com/t/nc-die-auf-einem-thinkcentre-lauft-mit-synology-nas-per-sftp-verbinden/204842)

its clear you’re not a Nextcloud snap user, but this should work regardless of which installation method is used

---

<div class="post-metadata">

**Author:** ![TomW](https://help.nextcloud.com/letter_avatar/tomw/32/5_5575768a8748004e209b776fc1b2916d.png) [@TomW](https://help.nextcloud.com/u/TomW)\
**Post date:** [July 6, 2025, 2:21pm UTC](https://help.nextcloud.com/t/add-external-storage-sftp-undefined-array-key-mtime/218293/9 "2025-07-06T14:21:13Z")

</div>

Nextcloud is running on my Synology DS.  
But your link has put me on the right track.  
I hadn’t entered anything in the “root” field because I didn’t know what to put there. There was nothing in the documentation either, so I left it blank.  
But now I have entered the path to my directory and now everything works.

---

<div class="post-metadata">

**Author:** ![system](https://help.nextcloud.com/user_avatar/help.nextcloud.com/system/32/29333_2.png) [@system](https://help.nextcloud.com/u/system)\
**Post date:** [July 14, 2025, 2:21pm UTC](https://help.nextcloud.com/t/add-external-storage-sftp-undefined-array-key-mtime/218293/10 "2025-07-14T14:21:38Z")

</div>

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.
