{"record":{"id":"bfbfb95f196145d4","repo":"benbjohnson/litestream","slug":"invalid-unlock-target-s","errorCode":null,"errorMessage":"invalid unlock target: %s","messagePattern":"invalid unlock target: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"vfs.go","lineNumber":2331,"sourceCode":"\t\t\t}\n\t\t\tf.vfs.writeMu.Unlock()\n\t\t}\n\t\tf.inTransaction = true\n\t\tf.logger.Debug(\"transaction started\", \"expectedTXID\", f.expectedTXID)\n\t}\n\n\tf.lockType = elock\n\treturn nil\n}\n\nfunc (f *VFSFile) Unlock(elock sqlite3vfs.LockType) error {\n\tf.logger.Debug(\"unlocking file\", \"lock\", elock)\n\n\tf.mu.Lock()\n\tdefer f.mu.Unlock()\n\n\tif elock != sqlite3vfs.LockShared && elock != sqlite3vfs.LockNone {\n\t\treturn fmt.Errorf(\"invalid unlock target: %s\", elock)\n\t}\n\n\tif f.writeEnabled && f.inTransaction && elock < sqlite3vfs.LockReserved {\n\t\tf.inTransaction = false\n\t\tif f.vfs != nil {\n\t\t\tf.vfs.writeMu.Lock()\n\t\t\tif f.vfs.writeFile == f {\n\t\t\t\tf.vfs.writeFile = nil\n\t\t\t}\n\t\t\tf.vfs.writeMu.Unlock()\n\t\t}\n\t\tf.logger.Debug(\"transaction ended\", \"dirtyPages\", len(f.dirty))\n\t\tf.cond.Broadcast() // Wake up SetWriteEnabledWithTimeout if waiting\n\t}\n\n\tf.lockType = elock\n\n\t// Copy pending index to main index and invalidate affected pages in cache.","sourceCodeStart":2313,"sourceCodeEnd":2349,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/vfs.go#L2313-L2349","documentation":"VFSFile.Unlock rejected an unlock target other than SHARED or NONE — SQLite only ever unlocks down to those levels. Any other target means corrupted lock-state tracking or a misbehaving SQLite build issuing invalid unlock transitions.","triggerScenarios":"Thrown at vfs.go:2331 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Report as a bug with the SQLite version in use","Check for a non-standard SQLite build driving the VFS"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3","analyzedAt":"2026-09-06T18:29:25.564Z","contentChangedAt":"2026-09-06T18:29:25.564Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}