Repository navigation
Nextcloud File Locking gets out of sync #1940
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't workingneed to reproduceIssue that has not been reproducedIssue that has not been reproduced
Description
Sometimes the nextcloud android app break and fails to sync a note. Only opening the file in the browser and closing it again resolves it
Steps to reproduce
This issue is not 100% reproducible every time, but I found it using that way:
- Use Android app to edit notes
- Edit the file with the website again (after closing the android app)
- Use the Android app again to edit again
Expected behaviour
The app syncs fine
Actual behaviour
The Server logs an error (attached below)
And the notes app shows an error that is not able to sync. Only if you go to the website, open and close the note, the sync works again
Server
- Notes app version: 6.0.1
- Nextcloud version: 34.0.1
- OS: Debian/LXC
- Web server: apache2 2.4.68-1~deb13u1
- PHP version: 8.4.23
- Database: mariadb
Nextcloud is ran behind an apache proxy server
Client
- Browser (incl. version): Firefox ESR 140.12.0
- OS: Debian Trixie with Wayland
The other Client is Android 16 using the latest available version of the notes android app
Log files
{
"reqId": "REDACTED",
"level": 3,
"time": "2026-07-17T04:12:11+00:00",
"remoteAddr": "REDACTED",
"user": "REDACTED",
"app": "notes",
"method": "PUT",
"url": "/index.php/apps/notes/api/v1/notes/23228?",
"scriptName": "/index.php",
"message": "Controller failed with OCP\\Lock\\ManuallyLockedException",
"userAgent": "Mozilla/5.0 (Android) Nextcloud-android/34.0.1",
"version": "34.0.1.2",
"exception": {
"Exception": "OCP\\Lock\\ManuallyLockedException",
"Message": "\"files/Notizen/Privat/Todo.md\" is locked, existing lock on file: files_lock/1ed743bc-1034-40ef-9711-3a5ab33e994c",
"Code": 0,
"Trace": [
{
"file": "/var/www/nextcloud/apps/files_lock/lib/Storage/LockWrapper.php",
"line": 213,
"function": "checkPermissions",
"class": "OCA\\FilesLock\\Storage\\LockWrapper",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php",
"line": 150,
"function": "file_put_contents",
"class": "OCA\\FilesLock\\Storage\\LockWrapper",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/Files/View.php",
"line": 1235,
"function": "file_put_contents",
"class": "OC\\Files\\Storage\\Wrapper\\Wrapper",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/Files/View.php",
"line": 680,
"function": "basicOperation",
"class": "OC\\Files\\View",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/Files/Node/File.php",
"line": 56,
"function": "file_put_contents",
"class": "OC\\Files\\View",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/notes/lib/Service/Note.php",
"line": 174,
"function": "putContent",
"class": "OC\\Files\\Node\\File",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/notes/lib/Controller/NotesApiController.php",
"line": 174,
"function": "setContent",
"class": "OCA\\Notes\\Service\\Note",
"type": "->"
},
{
"file": "/var/www/nextcloud/apps/notes/lib/Service/Util.php",
"line": 25,
"function": "{closure:OCA\\Notes\\Controller\\NotesApiController::update():164}",
"class": "OCA\\Notes\\Controller\\NotesApiController",
"type": "->",
"args": [
"*** sensitive parameters replaced ***"
]
},
{
"file": "/var/www/nextcloud/apps/notes/lib/Controller/Helper.php",
"line": 135,
"function": "retryIfLocked",
"class": "OCA\\Notes\\Service\\Util",
"type": "::"
},
{
"file": "/var/www/nextcloud/apps/notes/lib/Controller/NotesApiController.php",
"line": 164,
"function": "handleErrorResponse",
"class": "OCA\\Notes\\Controller\\Helper",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
"line": 165,
"function": "update",
"class": "OCA\\Notes\\Controller\\NotesApiController",
"type": "->",
"args": [
"*** sensitive parameters replaced ***"
]
},
{
"file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
"line": 78,
"function": "executeController",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
"line": 137,
"function": "dispatch",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/Route/Router.php",
"line": 324,
"function": "main",
"class": "OC\\AppFramework\\App",
"type": "::"
},
{
"file": "/var/www/nextcloud/lib/base.php",
"line": 1159,
"function": "match",
"class": "OC\\Route\\Router",
"type": "->"
},
{
"file": "/var/www/nextcloud/index.php",
"line": 25,
"function": "handleRequest",
"class": "OC",
"type": "::"
}
],
"File": "/var/www/nextcloud/apps/files_lock/lib/Storage/LockWrapper.php",
"Line": 82,
"message": "Controller failed with OCP\\Lock\\ManuallyLockedException",
"exception": "{\"class\":\"OCP\\Lock\\ManuallyLockedException\",\"message\":\"\\\"files/Notizen/Privat/Todo.md\\\" is locked, existing lock on file: files_lock/1ed743bc-1034-40ef-9711-3a5ab33e994c\",\"code\":0,\"file\":\"/var/www/nextcloud/apps/files_lock/lib/Storage/LockWrapper.php:82\",\"trace\":\"#0 /var/www/nextcloud/apps/files_lock/lib/Storage/LockWrapper.php(213): OCA\\FilesLock\\Storage\\LockWrapper->checkPermissions()\\n#1 /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(150): OCA\\FilesLock\\Storage\\LockWrapper->file_put_contents()\\n#2 /var/www/nextcloud/lib/private/Files/View.php(1235): OC\\Files\\Storage\\Wrapper\\Wrapper->file_put_contents()\\n#3 /var/www/nextcloud/lib/private/Files/View.php(680): OC\\Files\\View->basicOperation()\\n#4 /var/www/nextcloud/lib/private/Files/Node/File.php(56): OC\\Files\\View->file_put_contents()\\n#5 /var/www/nextcloud/apps/notes/lib/Service/Note.php(174): OC\\Files\\Node\\File->putContent()\\n#6 /var/www/nextcloud/apps/notes/lib/Controller/NotesApiController.php(174): OCA\\Notes\\Service\\Note->setContent()\\n#7 /var/www/nextcloud/apps/notes/lib/Service/Util.php(25): OCA\\Notes\\Controller\\NotesApiController->{closure:OCA\\Notes\\Controller\\NotesApiController::update():164}()\\n#8 /var/www/nextcloud/apps/notes/lib/Controller/Helper.php(135): OCA\\Notes\\Service\\Util::retryIfLocked()\\n#9 /var/www/nextcloud/apps/notes/lib/Controller/NotesApiController.php(164): OCA\\Notes\\Controller\\Helper->handleErrorResponse()\\n#10 /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php(165): OCA\\Notes\\Controller\\NotesApiController->update()\\n#11 /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php(78): OC\\AppFramework\\Http\\Dispatcher->executeController()\\n#12 /var/www/nextcloud/lib/private/AppFramework/App.php(137): OC\\AppFramework\\Http\\Dispatcher->dispatch()\\n#13 /var/www/nextcloud/lib/private/Route/Router.php(324): OC\\AppFramework\\App::main()\\n#14 /var/www/nextcloud/lib/base.php(1159): OC\\Route\\Router->match()\\n#15 /var/www/nextcloud/index.php(25): OC::handleRequest()\\n#16 {main}\"}",
"CustomMessage": "Controller failed with OCP\\Lock\\ManuallyLockedException"
},
"id": "REDACTED"
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingneed to reproduceIssue that has not been reproducedIssue that has not been reproduced
Activity
schemil053 commentedon Jul 18, 2026
May be related to nextcloud/notes-android#3237
spintike commentedon Jul 20, 2026
Same issue here with nearly the same parameters (versions etc.) and checking the server log.
thmsaurel commentedon Jul 23, 2026
I have the same issue using mostly a text editor with local synchronization.
The issue seems related to the web editior.
heapifyman commentedon Jul 23, 2026
I noticed that the notes file (.md) is marked as locked in the Nextcloud Files App
after it was edited in the Nextcloud Notes App (web app).
Afterwards the Nextcloud Notes App (Android) was not able to sync the note anymore with the exception mentioned above.
This seems to happen only if the Notes App (web) is set to use "Rich Text".
The file does not get locked when selecting "Plain text" or "Preview"
robsteady commentedon Jul 25, 2026
Thank you, @heapifyman ! This has been driving me insane. I even set up a Joplin server and started using that because I could not find a fix. I switched the Notes app to Plain text and now everything works as expected again.
MegaV0lt commentedon Jul 26, 2026
I get also sync error in app
larwood commentedon Aug 20, 2026
This is still an issue in Notes 6.0.2
eziocangialosi commentedon Aug 27, 2026
I got the exactly same issue
The issue disappear when I switch the Display mode from "Rich text" to "Plain text" in the webapp as saying @heapifyman just upward.
As everyone here i got the "file lock" error in the server logs (Nextcloud Hub 26 Spring 34.0.2 with Notes 6.0.2)
eziocangialosi commentedon Aug 28, 2026
A workaround appears possible: undo the change made in the Android app (to revert to a version matching the one in the web app). Deselect the note in the web app, then re-apply the change in the Android app; synchronization should then be possible.
Note that the note file appears to be locked as long as the note is selected in the web app (even if the changes have already been applied).
If a change is made in the Android app while the note is selected (and thus locked) in the web app, a
ManuallyLockedExceptionwill be thrown until the Android app matches the version existing on the server.larwood commentedon Sep 15, 2026
This is still an issue in Notes 6.1.0
cheywood commentedon Sep 16, 2026
Behaviour seen with Notes 6.1.0:
Fix Memories indexing and stale Text file locks
JL710 commentedon Sep 27, 2026
I updated my nextcloud aio yesterday to 34.0.4 and notice this issue since then with the latest app version 35.0.0.
A workaround that somewhat works for me is the one from @eziocangialosi. As long as there is no open browser tab with the note open, the sync works (again). As soon as that is not the case, the note seems unable to push.
sallyhaj commentedon Oct 1, 2026
I have similar issue:
Nextcloud server 35.0.0.10,files_lock 35.0.0,Notes Android 35.0.0.unsent edit to the same note.
PUT /apps/notes/api/v1/notes/<id>returns 423 withOCP\Lock\ManuallyLockedException, and theapp only shows
{"errorType":"Exception"}.occ text:reset <fileId>clears it at once. Settingfiles_lock lock_timeoutto 30 makesthe lock expire by itself, but the device still fails for up to 30 minutes.
staticdev commentedon Oct 5, 2026
I have same issue after upgrading to NC
35.0.1, notes6.1.0and I use as well the android app on version35.0.0.A short workaround I found for those suffering with this:
nextcloud-occ files:lock --unlock <NOTE_ID> <YOUR_NEXTCLOUD_USERNAME>melo0187 commentedon Oct 14, 2026
I even went this far:
occ app:disable files_lockFunny enough things work better now in my humble opinion. If the web UI encounters a conflict it makes it very clear and easily resolvable.
sallyhaj commentedon Oct 15, 2026
Note: This comment with the help of AI:
Some more findings since my last comment (Notes 6.1.0, Text 9.0.0, files_lock 35.0.0, Notes Android 35.0.0):
files_locklock (owner Text) when it opens the note. The lock leaks when the editor goes away without calling/close.files_lock lock_timeout defaultsto-1, so the leaked lock never expires.PUT /apps/text/session/<id>/create), synced for about a minute, then stopped without ever sending/close.The lock stayed.
directEditing), and its edits save fine through Text. Meanwhile the same app's sync,PUT /apps/notes/api/v1/notes/<id>, gets 423ManuallyLockedExceptionon every retry.occ text:reset <fileId> without--force. It refuses if the editor still holds unsaved changes. The<id>in the failing PUT is the file id.{"errorType":"Exception"}?