tinyhumansai/openhuman · error

open workspace lock file {lock_path:?}: {e}

Error message

open workspace lock file {lock_path:?}: {e}

What it means

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.

Source

Thrown at src/openhuman/tools/impl/filesystem/update_memory_md.rs:87

        if let Ok(meta) = std::fs::symlink_metadata(&lock_path) {
            if meta.file_type().is_symlink() {
                return Err(anyhow::anyhow!(
                    "workspace lock file {lock_path:?} is a symlink; refusing to follow it"
                ));
            }
        }
        let mut opts = std::fs::OpenOptions::new();
        opts.create(true).write(true).truncate(false);
        #[cfg(unix)]
        {
            // O_NOFOLLOW closes the TOCTOU window: if a symlink is swapped in
            // after the check above, the open fails (ELOOP) rather than follows.
            use std::os::unix::fs::OpenOptionsExt;
            opts.custom_flags(libc::O_NOFOLLOW);
        }
        let file = opts
            .open(&lock_path)
            .map_err(|e| anyhow::anyhow!("open workspace lock file {lock_path:?}: {e}"))?;
        file.lock_exclusive()
            .map_err(|e| anyhow::anyhow!("acquire workspace write flock: {e}"))?;
        Ok::<std::fs::File, anyhow::Error>(file)
    })
    .await
    .map_err(|e| anyhow::anyhow!("workspace lock task join failed: {e}"))?
}

/// Atomically replace `path`'s contents with `content`.
///
/// Writes to a sibling temp file in the same directory (so the rename stays on
/// one filesystem and is atomic) and `rename`s it over the target. A crash
/// mid-write leaves either the old file or the complete new file — never a
/// half-written truncation. Callers MUST hold the per-workspace write lock so
/// the read-modify-write is serialized end-to-end.
async fn atomic_write(path: &Path, file: &str, content: &str) -> anyhow::Result<()> {
    let dir = path
        .parent()

View on GitHub (pinned to 7491200858)

Solutions

  1. Read {e}: ELOOP means a symlink appeared — remove it and retry
  2. Fix directory permissions on the workspace
  3. Retry on transient races
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at src/openhuman/tools/impl/filesystem/update_memory_md.rs:87 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/570533c31434680e. Report an issue: GitHub.