[Bug]: SessionNotAvailableException when attempting to write files from a link share over webdav
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
I am attempting to mount a public share via davfs2. Mounting works, reading works, but when attempting to write to the share, I get an input/output error in davfs2 and a OCP\Session\Exceptions\SessionNotAvailableException on Nextcloud's side.
Writing is enabled in the share permissions and works without issues when accessing the share via browser (tested by uploading the same file I couldnt write via davfs2).
Steps to reproduce
- Create a public share, configure it to allow read/write
- Setup davfs2 and a mount unit with the share credentials (share handle is the path suffix of the share URL):
$ cat /etc/davfs2/secrets /run/test <share-handle> "" $ systemctl cat run-test.mount [Unit] Before=remote-fs.target umount.target Conflicts=umount.target After=network-online.target [Mount] What=https://<nextcloud-domain>/public.php/dav/files/<share-handle> Where=/run/test Type=davfs TimeoutSec=30s Options=defaults,uid=1000,grpid,file_mode=0660,x-systemd.automount,x-systemd.mount-timeout=30,_netdev [Install] WantedBy=multi-user.target - Mount the share
$ systemctl daemon-reload && systemctl start run-test.mount - Verify it is mounted and reading works
$ cat /run/test/some-test-file.txt - Attempt to upload a new file
$ cp ./new-file.txt /run/test/new-file.txt cp: cannot create regular file '/run/media/tobias/keepass/personal_accounts.kdbx': Input/output error
Expected behavior
When a share is configured accordingly, reading and writing should work via webdav.
Nextcloud Server version
34
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.5
Web server
Apache (supported)
Database engine version
MySQL
Is this bug present after an update or on a fresh install?
Upgraded to a MAJOR version (ex. 31 to 32)
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
- Default user-backend (database)
- LDAP/ Active Directory
- SSO - SAML
- Other
Configuration report
{
"system": {
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": {
"0": "localhost",
"5": "nextcloudpi.local",
"1": "192.168.178.31",
"7": "nextcloudpi",
"8": "nextcloudpi.lan",
"2": "***REMOVED SENSITIVE VALUE***",
"11": "***REMOVED SENSITIVE VALUE***",
"12": "***REMOVED SENSITIVE VALUE***",
"14": "nextcloudpi",
"3": "***REMOVED SENSITIVE VALUE***",
"22": "***REMOVED SENSITIVE VALUE***",
},
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"overwrite.cli.url": "***REMOVED SENSITIVE VALUE***",
"dbtype": "mysql",
"version": "34.0.2.1",
"dbname": "***REMOVED SENSITIVE VALUE***",
"dbhost": "***REMOVED SENSITIVE VALUE***",
"dbport": "",
"dbtableprefix": "oc_",
"mysql.utf8mb4": true,
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"installed": true,
"instanceid": "***REMOVED SENSITIVE VALUE***",
"memcache.local": "\\OC\\Memcache\\Redis",
"memcache.locking": "\\OC\\Memcache\\Redis",
"redis": {
"host": "***REMOVED SENSITIVE VALUE***",
"port": 0,
"timeout": 0,
"password": "***REMOVED SENSITIVE VALUE***"
},
"tempdirectory": "\/mnt\/ncp\/ncdata\/data\/tmp",
"mail_smtpmode": "smtp",
"mail_smtpauthtype": "LOGIN",
"mail_from_address": "***REMOVED SENSITIVE VALUE***",
"mail_domain": "***REMOVED SENSITIVE VALUE***",
"mail_template_class": "\\OCA\\EmailTemplates\\EmailTemplate",
"overwriteprotocol": "https",
"theme": "",
"loglevel": 2,
"maintenance": false,
"logfile": "\/mnt\/ncp\/ncdata\/data\/nextcloud.log",
"mail_sendmailmode": "smtp",
"log_type": "file",
"jpeg_quality": 60,
"data-fingerprint": "027045aed0be1491c6126ef8507a9599",
"app_install_overwrite": {
"0": "end_to_end_encryption",
"1": "twofactor_yubikey",
"2": "social",
"3": "whiteboard",
"5": "nextcloudpi",
"7": "maps",
"8": "memories"
},
"auth.bruteforce.protection.enabled": false,
"mail_smtpauth": true,
"mail_smtphost": "***REMOVED SENSITIVE VALUE***",
"mail_smtpport": "587",
"mail_smtpname": "***REMOVED SENSITIVE VALUE***",
"mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
"trusted_proxies": "***REMOVED SENSITIVE VALUE***",
"default_phone_region": "DE",
"filelocking": true,
"preview_max_x": 2048,
"preview_max_y": 2048,
"preview_imaginary_url": "***REMOVED SENSITIVE VALUE***",
"enabledPreviewProviders": [
"OC\\Preview\\BMP",
"OC\\Preview\\GIF",
"OC\\Preview\\JPEG",
"OC\\Preview\\MarkDown",
"OC\\Preview\\MP3",
"OC\\Preview\\PNG",
"OC\\Preview\\TXT",
"OC\\Preview\\XBitmap",
"OC\\Preview\\OpenDocument",
"OC\\Preview\\Krita",
"OC\\Preview\\Image",
"OC\\Preview\\Movie"
],
"memories.exiftool": "\/var\/www\/nextcloud\/apps\/memories\/exiftool-bin\/exiftool-aarch64-glibc",
"memories.vod.path": "\/var\/www\/nextcloud\/apps\/memories\/bin-ext\/go-vod-amd64",
"memories.exiftool_no_local": true,
"memories.vod.ffmpeg": "\/usr\/bin\/ffmpeg",
"memories.vod.ffprobe": "\/usr\/bin\/ffprobe",
"has_rebuilt_cache": true,
"maintenance_window_start": 2,
"memories.db.triggers.fcu": true,
"memories.gis_type": 1,
"defaultapp": "files,dashboard",
"files.chunked_upload.max_size": 1073741824,
"serverid": 135,
"openmetrics_allowed_clients": [
"0.0.0.0\/0"
],
"allow_local_remote_servers": false
}
}
List of activated Apps
Enabled:
- activity: 7.0.0
- admin_audit: 1.24.0
- announcementcenter: 7.4.1
- app_api: 34.0.0
- appointments: 2.7.4
- appstore: 1.0.0
- assistant: 3.5.0
- attendance: 1.42.0
- audioplayer: 3.9.0
- bookmarks: 16.2.4
- bruteforcesettings: 7.0.0
- calendar: 6.5.2
- circles: 34.0.0
- cloud_federation_api: 1.18.0
- collectives: 4.4.2
- comments: 1.24.0
- contacts: 8.7.5
- contactsinteraction: 1.15.0
- context_chat: 5.4.0
- cookbook: 0.11.9
- cospend: 4.0.2
- dashboard: 7.14.0
- dav: 1.39.0
- dav_push: 1.0.2
- deck: 1.18.3
- event_update_notification: 2.9.0
- external: 9.0.1
- federatedfilesharing: 1.24.0
- federation: 1.24.0
- files: 2.6.0
- files_automatedtagging: 5.0.0
- files_downloadlimit: 5.2.0
- files_external: 1.26.0
- files_lock: 34.0.1
- files_pdfviewer: 7.0.0-dev.0
- files_reminders: 1.7.0
- files_sharing: 1.26.0
- files_trashbin: 1.24.0
- files_versions: 1.27.0
- firstrunwizard: 7.0.0-dev.0
- forms: 5.3.5
- gpoddersync: 3.17.0
- group_everyone: 0.1.20
- impersonate: 5.0.0
- integration_openai: 4.5.2
- integration_paperless: 1.0.13
- logreader: 7.0.0
- lookup_server_connector: 1.22.0
- maps: 1.7.1
- memories: 8.1.0
- music: 3.1.1
- musicsheetviewer: 1.3.1
- nextcloud_announcements: 6.0.0
- nextcloudpi: 0.0.2
- notes: 6.0.1
- notifications: 7.0.0-dev.1
- notify_push: 1.3.5
- oauth2: 1.22.0
- office: 1.0.0
- password_policy: 6.0.0-dev.0
- phonetrack: 1.3.2
- photos: 7.0.0
- polls: 9.1.4
- previewgenerator: 5.14.0
- privacy: 6.0.0-dev.1
- profile: 1.3.0
- provisioning_api: 1.24.0
- qownnotesapi: 26.5.0
- recognize: 12.0.0
- recommendations: 7.0.0
- registration: 3.0.0
- related_resources: 5.0.0-dev.0
- richdocuments: 11.1.0
- richdocumentscode: 26.4.104
- secrets: 3.0.5
- serverinfo: 6.0.0
- settings: 1.17.0
- sharebymail: 1.24.0
- side_menu: 6.0.1
- spreed: 24.0.3
- survey_client: 6.0.0-dev.0
- systemtags: 1.24.0
- tables: 2.2.1
- tasks: 0.18.1
- text: 8.0.0
- text_templates: 1.5.0
- theming: 2.9.0
- twofactor_backupcodes: 1.23.0
- twofactor_nextcloud_notification: 8.0.0
- twofactor_totp: 16.0.0
- twofactor_webauthn: 2.7.0
- user_status: 1.14.0
- viewer: 7.0.0-dev.0
- weather_status: 1.14.0
- webhook_listeners: 1.6.0
- whiteboard: 1.5.9
- workflowengine: 2.16.0
Disabled:
- camerarawpreviews: 1.1.2 (installed 1.1.2)
- drawio: 4.3.5 (installed 4.3.5)
- encryption: 2.22.0
- files_3dmodelviewer: 0.0.18 (installed 0.0.18)
- files_fulltextsearch: 33.0.0 (installed 33.0.0)
- files_fulltextsearch_tesseract: 32.0.0 (installed 32.0.0)
- fulltextsearch: 33.0.0 (installed 33.0.0)
- fulltextsearch_elasticsearch: 33.0.0 (installed 33.0.0)
- fulltextsearch_opensearch: 0.0.1 (installed 0.0.1)
- google_synchronization: 4.2.0 (installed 4.2.0)
- integration_giphy: 2.2.1 (installed 2.2.1)
- keeweb: 0.6.26 (installed 0.6.26)
- libresign: 14.1.0 (installed 14.1.0)
- nextpod: 0.7.11 (installed 0.7.11)
- support: 6.0.0 (installed 1.0.0)
- suspicious_login: 12.0.0-dev.0
- testing: 1.23.0
- thesearchpage: 2.4.3 (installed 2.4.3)
- updatenotification: 1.24.0 (installed 1.11.0)
- user_ldap: 1.25.0
Nextcloud Signing status
No errors have been found.
Nextcloud Logs
Lots of (potentially related):
{
"reqId": "amxenYeakDRb0N1uRUhaWwAAAwo",
"level": 2,
"time": "2026-07-31T08:36:45+00:00",
"remoteAddr": "2a02:3102:8420:4a0:90fe:baff:fe88:40ff",
"user": "--",
"app": "PHP",
"method": "PROPFIND",
"url": "/public.php/webdav/<some-path>/.nomemories",
"scriptName": "/public.php",
"message": "Cannot modify header information - headers already sent by (output started at /var/www/nextcloud/3rdparty/sabre/http/lib/Message.php:117) at /var/www/nextcloud/3rdparty/sabre/http/lib/Sapi.php#68",
"userAgent": "sabre-dav/4.7.0 (http://sabre.io/)",
"version": "34.0.2.1",
"data": {
"app": "PHP"
}
}
And this is the actual error when attempting to write the file:
{
"reqId": "amxTDboSsHG29mnH745i7QAAURg",
"level": 3,
"time": "2026-07-31T07:47:25+00:00",
"remoteAddr": "2a02:8106:1ea:8000:abe3:638d:62fc:917c",
"user": "--",
"app": "webdav",
"method": "LOCK",
"url": "/public.php/webdav/qt_temp.BeKoQI",
"scriptName": "/public.php",
"message": "Exception thrown: OCP\\Session\\Exceptions\\SessionNotAvailableException",
"userAgent": "davfs2/1.7.3 neon/0.37.1",
"version": "34.0.2.1",
"exception": {
"Exception": "OCP\\Session\\Exceptions\\SessionNotAvailableException",
"Message": "",
"Code": 0,
"Trace": [
{
"file": "/var/www/nextcloud/apps/files_lock/lib/DAV/LockBackend.php",
"line": 124,
"function": "getFileFromUri",
"class": "OCA\\FilesLock\\Service\\FileService",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/files_lock/lib/DAV/LockBackend.php",
"line": 68,
"function": "getFileFromUri",
"class": "OCA\\FilesLock\\DAV\\LockBackend",
"type": "->"
},
{
"file": "/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Locks/Plugin.php",
"line": 322,
"function": "lock",
"class": "OCA\\FilesLock\\DAV\\LockBackend",
"type": "->"
},
{
"file": "/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Locks/Plugin.php",
"line": 236,
"function": "lockNode",
"class": "Sabre\\DAV\\Locks\\Plugin",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/files_lock/lib/DAV/LockPlugin.php",
"line": 218,
"function": "httpLock",
"class": "Sabre\\DAV\\Locks\\Plugin",
"type": "->"
},
{
"file": "/var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
"line": 89,
"function": "httpLock",
"class": "OCA\\FilesLock\\DAV\\LockPlugin",
"type": "->"
},
{
"file": "/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",
"line": 472,
"function": "emit",
"class": "Sabre\\DAV\\Server",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Server.php",
"line": 215,
"function": "invokeMethod",
"class": "Sabre\\DAV\\Server",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/dav/appinfo/v1/publicwebdav.php",
"line": 136,
"function": "start",
"class": "OCA\\DAV\\Connector\\Sabre\\Server",
"type": "->"
},
{
"file": "/var/www/nextcloud/public.php",
"line": 90,
"args": [
"/var/www/nextcloud/apps/dav/appinfo/v1/publicwebdav.php"
],
"function": "require_once"
}
],
"File": "/var/www/nextcloud/apps/files_lock/lib/Service/FileService.php",
"Line": 85,
"message": "",
"exception": "{\"class\":\"OCP\\Session\\Exceptions\\SessionNotAvailableException\",\"message\":\"\",\"code\":0,\"file\":\"/var/www/nextcloud/apps/files_lock/lib/Service/FileService.php:85\",\"trace\":\"#0 /var/www/nextcloud/apps/files_lock/lib/DAV/LockBackend.php(124): OCA\\FilesLock\\Service\\FileService->getFileFromUri()\\n#1 /var/www/nextcloud/apps/files_lock/lib/DAV/LockBackend.php(68): OCA\\FilesLock\\DAV\\LockBackend->getFileFromUri()\\n#2 /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Locks/Plugin.php(322): OCA\\FilesLock\\DAV\\LockBackend->lock()\\n#3 /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Locks/Plugin.php(236): Sabre\\DAV\\Locks\\Plugin->lockNode()\\n#4 /var/www/nextcloud/apps/files_lock/lib/DAV/LockPlugin.php(218): Sabre\\DAV\\Locks\\Plugin->httpLock()\\n#5 /var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php(89): OCA\\FilesLock\\DAV\\LockPlugin->httpLock()\\n#6 /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php(472): Sabre\\DAV\\Server->emit()\\n#7 /var/www/nextcloud/apps/dav/lib/Connector/Sabre/Server.php(215): Sabre\\DAV\\Server->invokeMethod()\\n#8 /var/www/nextcloud/apps/dav/appinfo/v1/publicwebdav.php(136): OCA\\DAV\\Connector\\Sabre\\Server->start()\\n#9 /var/www/nextcloud/public.php(90): require_once('...')\\n#10 {main}\"}",
"CustomMessage": "Exception thrown: OCP\\Session\\Exceptions\\SessionNotAvailableException"
}
}
Additional info
This setup worked with Nextcloud up to 33, albeit using the (old?) endpoint https:///public.php/webdav instead of https:///public.php/dav/files/ - neither of which works since the update to NC 34.
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 apps/files_lock/lib/DAV/LockBackend.php, named in the SessionNotAvailableException trace, and reproduce the write through the public WebDAV endpoint using davfs2. Compare the LOCK request and the browser upload path, then trace the session failure. Done means writing a file through a read/write public share succeeds without the exception.
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
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100