{"record":{"id":"570533c31434680e","repo":"tinyhumansai/openhuman","slug":"open-workspace-lock-file-lock-path-e","errorCode":null,"errorMessage":"open workspace lock file {lock_path:?}: {e}","messagePattern":"open workspace lock file (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/tools/impl/filesystem/update_memory_md.rs","lineNumber":87,"sourceCode":"        if let Ok(meta) = std::fs::symlink_metadata(&lock_path) {\n            if meta.file_type().is_symlink() {\n                return Err(anyhow::anyhow!(\n                    \"workspace lock file {lock_path:?} is a symlink; refusing to follow it\"\n                ));\n            }\n        }\n        let mut opts = std::fs::OpenOptions::new();\n        opts.create(true).write(true).truncate(false);\n        #[cfg(unix)]\n        {\n            // O_NOFOLLOW closes the TOCTOU window: if a symlink is swapped in\n            // after the check above, the open fails (ELOOP) rather than follows.\n            use std::os::unix::fs::OpenOptionsExt;\n            opts.custom_flags(libc::O_NOFOLLOW);\n        }\n        let file = opts\n            .open(&lock_path)\n            .map_err(|e| anyhow::anyhow!(\"open workspace lock file {lock_path:?}: {e}\"))?;\n        file.lock_exclusive()\n            .map_err(|e| anyhow::anyhow!(\"acquire workspace write flock: {e}\"))?;\n        Ok::<std::fs::File, anyhow::Error>(file)\n    })\n    .await\n    .map_err(|e| anyhow::anyhow!(\"workspace lock task join failed: {e}\"))?\n}\n\n/// Atomically replace `path`'s contents with `content`.\n///\n/// Writes to a sibling temp file in the same directory (so the rename stays on\n/// one filesystem and is atomic) and `rename`s it over the target. A crash\n/// mid-write leaves either the old file or the complete new file — never a\n/// half-written truncation. Callers MUST hold the per-workspace write lock so\n/// the read-modify-write is serialized end-to-end.\nasync fn atomic_write(path: &Path, file: &str, content: &str) -> anyhow::Result<()> {\n    let dir = path\n        .parent()","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/tools/impl/filesystem/update_memory_md.rs#L69-L105","documentation":"Opening the workspace .memory-write.lock file failed with the OS error {e} (permissions, ENOENT after create race, or ELOOP from O_NOFOLLOW on Unix when a symlink was swapped in after the symlink check). The exclusive lock could not be taken, so the MEMORY.md write is aborted.","triggerScenarios":"Thrown at src/openhuman/tools/impl/filesystem/update_memory_md.rs:87 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read {e}: ELOOP means a symlink appeared — remove it and retry","Fix directory permissions on the workspace","Retry on transient races"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}