openai/codex · error · anyhow::Error
timed out waiting for daemon operation lock
Error message
timed out waiting for daemon operation lock {} What it means
acquire_operation_lock opened the daemon operation lock file and spun until its deadline without obtaining the lock, so another concurrent daemon lifecycle operation (start/stop/restart/bootstrap) is still in flight.
Solutions
- Wait for the in-flight daemon operation to finish and retry
- Check for hung `codex app-server-daemon` processes and terminate them
- Remove a stale operation lock file if no live process holds it
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at codex-rs/app-server-daemon/src/lib.rs:718 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
AI-assisted analysis of openai/codex@339751715c (2026-08-25).
Data as JSON: /api/errors/00efc98c55ccf947.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/app-server-daemon/src/lib.rs:718
) -> BackendPaths {
BackendPaths {
codex_bin: managed_codex_bin.to_path_buf(),
pid_file: self.pid_file.clone(),
update_pid_file: self.update_pid_file.clone(),
remote_control_enabled: settings.remote_control_enabled,
}
}
async fn load_settings(&self) -> Result<DaemonSettings> {
DaemonSettings::load(&self.settings_file).await
}
async fn acquire_operation_lock(&self) -> Result<tokio::fs::File> {
let operation_lock = self.open_operation_lock_file().await?;
let deadline = tokio::time::Instant::now() + OPERATION_LOCK_TIMEOUT;
while !try_lock_file(&operation_lock)? {
if tokio::time::Instant::now() >= deadline {
return Err(anyhow!(
"timed out waiting for daemon operation lock {}",
self.operation_lock_file.display()
));
}
sleep(START_POLL_INTERVAL).await;
}
Ok(operation_lock)
}
async fn open_operation_lock_file(&self) -> Result<tokio::fs::File> {
if let Some(parent) = self.operation_lock_file.parent() {
tokio::fs::create_dir_all(parent).await.with_context(|| {
format!(
"failed to create daemon state directory {}",
parent.display()
)
})?;
}View on GitHub (pinned to 339751715c)