deepseek-ai/deepseek-harness · error

atomic-write: timed out waiting for the writer lock at ${loc

Error message

atomic-write: timed out waiting for the writer lock at ${lockPath}

What it means

Error "atomic-write: timed out waiting for the writer lock at ${lockPath}" thrown in deepseek-ai/deepseek-harness.

Source

Thrown at packages/util/atomic-write/src/index.ts:144

 * @returns the operation's result; the lock releases on both outcomes.
 */
export async function withFileLock<T>(
  filename: string,
  operation: () => Promise<T>,
  options?: FileLockOptions,
): Promise<T> {
  const lockPath = `${filename}.lock`
  const deadline = Date.now() + (options?.waitMs ?? DEFAULT_LOCK_WAIT_MS)
  let delay = LOCK_RETRY_INITIAL_MS
  for (;;) {
    try {
      await writeFile(lockPath, `${process.pid}\n`, { mode: 0o600, flag: 'wx' })
      break
    } catch (error) {
      if (!await isLockContention(error, lockPath)) throw error
    }
    if (Date.now() >= deadline) {
      throw new Error(`atomic-write: timed out waiting for the writer lock at ${lockPath}`)
    }
    await new Promise(resolve => setTimeout(resolve, delay))
    delay = Math.min(delay * 2, LOCK_RETRY_MAX_MS)
  }
  try {
    return await operation()
  } finally {
    await rm(lockPath, { force: true })
  }
}

View on GitHub (pinned to b150a551b8)

Solutions

  1. Remove the stale lock file if the previous writer crashed, or increase the lock timeout.

When it happens

Trigger: Thrown at packages/util/atomic-write/src/index.ts:144 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of deepseek-ai/deepseek-harness@b150a551b8 (2026-08-24). Data as JSON: /api/errors/7238552fda309ac3. Report an issue: GitHub.