[Bug]: External WebDAV storage — MKCOL returns HTTP 409, folder cache corruption and missing directory in Files
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 25/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- docker, php, postgresql
- Bereich
- backend, databases, distributed-systems
Rechercherichtung
Start by comparing the reported MKCOL request and responses with the external WebDAV storage behavior, then investigate how the storage backend updates oc_filecache during directory operations and scans. The report does not identify source files or tests, and the two symptoms have no confirmed shared cause. Done means reproducing and isolating the cache inconsistency and/or documenting a fix for the unresolved MKCOL interoperability issue with tests.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
⚠️ This issue respects the following points: ⚠️
- This is not a troubleshooting question, general support matter, or webserver/proxy problem, but likely a bug (if unsure, ask the Community Help Forum).
- This issue is not already reported on Github OR solved at the Community Help Forum (I've searched!).
- I'm using a maintained major version of Nextcloud Server and tested against the latest patch level. (Supported major versions and current patch levels).
- I agree to follow Nextcloud's Code of Conduct.
- I've tried my best to provide clear reproduction steps that someone unfamiliar with this bug could use to reproduce it.
Bug description
[Bug]: External WebDAV storage — MKCOL returns HTTP 409, folder cache corruption and missing directory in Files
Description
I am experiencing multiple issues with an external WebDAV storage mounted in Nextcloud 33.0.10.1.
The external storage is provided by an Nginx WebDAV server and contains a large collection of personal files, photos and videos.
Two issues have been observed:
- Creating a folder from Nextcloud Files can fail with HTTP 409 when Nextcloud sends a
MKCOLrequest without a trailing slash. - An existing directory (
media) disappeared from the Nextcloud Files interface despite being present on the underlying WebDAV server. Investigation revealed an inconsistent entry in PostgreSQL'soc_filecachetable.
The second issue was successfully repaired using a shallow scan of the external storage root, without changing the affected directory's fileid.
It is not yet established whether these two issues share the same root cause.
Environment
| Component | Configuration |
|---|---|
| Nextcloud | 33.0.10.1 |
| Deployment | Nextcloud All-in-One (Docker) |
| Host | Windows 10 Pro / Docker Desktop / WSL2 Debian 12 |
| Database | PostgreSQL |
| External storage backend | WebDAV |
| WebDAV server | Nginx (sfuhrm/docker-nginx-webdav:master) |
| Physical storage | Windows drive mounted into the WebDAV container |
| External mount | /Stockage externe |
| WebDAV remote root | /rage/ |
| Nextcloud user | admin |
| Android clients | Nextcloud Android Client and Photos for Nextcloud |
The WebDAV server and Nextcloud are connected over the local network.
The external storage contains approximately 38,500 cached entries, including over 31,700 entries beneath the media/ directory.
Issue 1 — MKCOL without trailing slash returns HTTP 409
Steps to reproduce
- Configure an external WebDAV storage in Nextcloud.
- Open the external storage in the Nextcloud Files web interface.
- Attempt to create a new directory.
- Observe that directory creation fails.
Nextcloud sends a MKCOL request similar to:
MKCOL /rage/documents/RCEngineering/Nouveau%20dossier HTTP/1.1
The Nginx WebDAV server returns:
HTTP/1.1 409 Conflict
Direct WebDAV testing
Authenticated curl tests against the WebDAV server confirmed that the server behaves differently depending on the trailing slash.
Without trailing slash:
MKCOL /rage/documents/RCEngineering/Nouveau%20dossier
Result:
HTTP/1.1 409 Conflict
With trailing slash:
MKCOL /rage/documents/RCEngineering/Nouveau%20dossier/
Result:
HTTP/1.1 201 Created
Nginx reports:
MKCOL can create a collection only
This appears to be a WebDAV interoperability issue between Nextcloud's folder-creation request and this particular Nginx WebDAV implementation.
I am not claiming that the WebDAV specification universally requires trailing slashes for MKCOL.
Additional observation
Following some failed operations, the external storage temporarily became unavailable or disappeared from the Nextcloud Files interface, before becoming accessible again.
The precise relationship between the HTTP 409 response and the temporary mount unavailability has not been established.
Issue 2 — Existing WebDAV directory disappears from Nextcloud Files
Symptoms
The remote WebDAV directory /rage/ contains three top-level directories:
/rage/
├── backup/
├── documents/
└── media/
However, the Nextcloud Files web interface displayed only:
Stockage externe/
├── backup/
└── documents/
The media directory was missing.
The directory contains a large photo and video collection, and was previously accessible.
Verification of the underlying WebDAV server
An authenticated PROPFIND request was executed directly against Nginx:
curl -i --basic -u webdav \
-X PROPFIND \
-H 'Depth: 1' \
'http://192.168.1.50:8099/rage/'
The server returned:
HTTP/1.1 207 Multi-Status
The XML response contained successful entries for:
/rage/
/rage/backup/
/rage/documents/
/rage/media/
Each resource was reported with HTTP 200 OK within the multistatus response.
Therefore, the missing directory was not caused by Nginx failing to enumerate /rage/media/ during this test.
PostgreSQL investigation
The affected external storage was identified in oc_storages:
numeric_id = 28
id = webdav::[email protected]:8099//rage/
The relevant cache entries were inspected with a read-only SQL query:
SELECT
f.fileid,
f.path,
f.parent,
m.mimetype,
f.permissions,
f.size
FROM oc_filecache f
LEFT JOIN oc_mimetypes m ON m.id = f.mimetype
WHERE f.storage = 28
AND f.path IN ('', 'backup', 'documents', 'media')
ORDER BY f.path;
Cache state before repair
| Path | File ID | Parent | MIME type | Permissions |
|---|---|---|---|---|
| Root | 113062 | -1 | httpd/unix-directory |
31 |
backup |
113063 | 113062 | httpd/unix-directory |
31 |
documents |
113064 | 113062 | httpd/unix-directory |
31 |
media |
113065 | 113065 (INVALID) | application/octet-stream (INVALID) |
27 |
Two inconsistencies were identified for media:
- Its
parentpointed to its ownfileid(113065), forming a circular parent relationship. - Its MIME type was
application/octet-streaminstead ofhttpd/unix-directory.
The expected parent was 113062, corresponding to the external storage root.
The media entry also had a cached size of 346164335630 bytes, while the storage root had a cached size of only 26366981385 bytes.
Investigation of child entries
A further read-only query returned:
total_entries = 38532
media_children = 31735
children_with_media_parent = 3764
The children_with_media_parent count includes the media entry itself, due to its circular parent reference.
Many files and subdirectories beneath media/ were already indexed, including JPEG images, MP4 videos and nested directories.
A query searching for other self-referencing entries or non-directory entries with children returned only the media entry.
This suggests that the observed inconsistency was localized rather than widespread within the examined storage.
Repair using the official Nextcloud CLI
A non-recursive scan of the external storage root was performed:
sudo docker exec --user www-data nextcloud-aio-nextcloud \
php occ files:scan \
--path="/admin/files/Stockage externe" \
--shallow \
-v
Output:
Starting scan for user 1 out of 1 (admin)
Folder /admin/files/Stockage externe/
Folders: 1
Files: 0
New: 0
Updated: 1
Removed: 0
Errors: 0
Elapsed time: 00:00:00
Cache state after repair
| Path | File ID | Parent | MIME type | Permissions |
|---|---|---|---|---|
| Root | 113062 | -1 | httpd/unix-directory |
31 |
backup |
113063 | 113062 | httpd/unix-directory |
31 |
documents |
113064 | 113062 | httpd/unix-directory |
31 |
media |
113065 | 113062 (FIXED) | httpd/unix-directory (FIXED) |
31 |
The scan corrected the directory's parent, MIME type and permissions.
Importantly, the directory retained its original fileid (113065).
After the scan, the cached size of the root and media became -1, indicating an unknown or uncalculated size.
UI result
After refreshing the Nextcloud Files web interface, all three directories were visible again:
Stockage externe/
├── backup/
├── documents/
└── media/
The missing-directory symptom was therefore resolved without manually editing PostgreSQL and without performing a full recursive scan of the media collection.
Additional context — Concurrent Android client activity
Before the directory disappeared, multiple Android applications had accessed the same photo collection through Nextcloud HTTPS:
- Nextcloud Android Client
- Photos for Nextcloud
Observed or recalled activity included:
- Automatic photo uploads
- Automatic photo browsing and reading
- Deletion of approximately one or two photos
- Concurrent access to the
mediadirectory
It is not known which Android application performed the deletions.
Both applications connected through Nextcloud, not directly to the underlying Nginx WebDAV server.
This activity occurred before the cache inconsistency was discovered, but no direct causal relationship has been demonstrated.
A possible concurrency or cache-update issue is worth investigating, particularly when operations on an external WebDAV storage overlap. Other explanations, including incorrect WebDAV metadata interpretation or cache invalidation behavior, remain possible.
Expected behavior
- Nextcloud should handle directory creation with compatible WebDAV servers, or report an appropriate interoperability error.
- Concurrent clients should not cause existing external WebDAV directories to acquire circular parent references or incorrect MIME types in
oc_filecache. - Existing directories returned by the external WebDAV server should remain visible in Nextcloud Files.
- Cache refresh operations should maintain consistent parent-child relationships and directory metadata.
Actual behavior
MKCOLwithout a trailing slash returns HTTP 409 on the tested Nginx backend.- An existing directory was recorded as
application/octet-streamwith its ownfileidas parent. - The directory disappeared from Nextcloud Files despite being available through direct WebDAV
PROPFIND. - A shallow scan of the external storage root repaired the cache entry and restored its visibility.
Questions for maintainers
- Could a failed WebDAV operation or concurrent cache refresh produce a self-referencing
parentinoc_filecache? - Is there a known issue in the external WebDAV storage backend concerning directory MIME type detection or cache invalidation?
- Could concurrent Android WebDAV operations trigger inconsistent cache metadata for an external storage directory?
- Should Nextcloud normalize trailing slashes for
MKCOLwhen interacting with WebDAV backends that require them? - Is there an existing integrity check that could detect or automatically repair circular parent references in
oc_filecache?
Workaround
For the missing-directory issue, the following command successfully restored the affected directory:
php occ files:scan \
--path="/admin/files/Stockage externe" \
--shallow
This is a recovery procedure, not a confirmed fix for the underlying cause.
The MKCOL interoperability issue remains unresolved.
Related issues
Potentially related reports:
- https://github.com/nextcloud/server/issues/62037
- https://github.com/nextcloud/server/issues/65731
- https://github.com/nextcloud/server/issues/52863
- https://github.com/nextcloud/server/issues/40338
These are references for comparison, not confirmed duplicates.
Additional notes
I can provide sanitized SQL results, WebDAV request/response traces, Nextcloud logs and screenshots if required.
The issue has not yet been reproduced under controlled conditions. The concurrent Android activity is contextual information, not proof of the root cause.
Steps to reproduce
See above
Expected behavior
See above
Nextcloud Server version
33
Operating system
None
PHP engine version
No response
Web server
No response
Database engine version
No response
Is this bug present after an update or on a fresh install?
No response
Are you using the Nextcloud Server Encryption module?
No response
What user-backends are you using?
- Default user-backend (database)
- LDAP/ Active Directory
- SSO - SAML
- Other
Configuration report
List of activated Apps
Nextcloud Signing status
Nextcloud Logs
Additional info
No response
- Vorherrschende Sprache
- PHP
- Sterne
- 37.5k
- Forks
- 5.4k
- Ø Merge
- 1 T. 13 Std.
- Gemergte PRs (30 T.)
- 639
Entwicklungsumgebung
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus nextcloud/server
-
35-feedback
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
0. Needs triage 35-feedback bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
Maintainer antworten meist innerhalb von 1 Tag
-
workflowengine: File entity reuses the node of the first "Tag assigned" event for all later events in the same processEvtl. vergeben @lazerg hat das vor 2 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
Maintainer antworten meist innerhalb von 1 Tag
-
Contacts import aborts with TypeError when vCards have no UID (TextImporter structure)Evtl. vergeben @SebastianKrupinski hat das vor 6 Tagen übernommen. Offenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
nextcloud/server#66486 · 2 Kommentare · 2 Reaktionen · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Unified search: screen reader hears "No matching results" on mobile even when there are resultsEvtl. vergeben @lazerg hat das vor 10 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in nextcloud/server
Ähnliche Issues
-
[Sync EN] stream: document the errors of the stream_context_*() and stream filter functions (#6091)Offensync-en
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 79/100
Automattic/blocks-engine#6318 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Update: Laravel Cheat Sheet - middleware examples for the bootstrap/app.php layout (small update)Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
OWASP/CheatSheetSeries#2990 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag