earendil-works/pi · error
Failed to acquire trust store lock
Error message
Failed to acquire trust store lock
What it means
Defensive fallback in acquireTrustLockSync: the proper-lockfile acquisition loop ended without a lock and without a wrapped Error to rethrow (e.g. a non-Error thrown value or unexpected library state). The lock on the trust store could not be obtained.
Solutions
- Retry the operation; transient ELOCKED races are retried internally with backoff
- Check for a stale .lock directory next to the trust store and remove it if no other process holds it
- Report as a bug if it persists, since the normal path rethrows the underlying error
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at packages/coding-agent/src/core/trust-manager.ts:166 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24).
Data as JSON: /api/errors/807bd6555005a14c.
Report an issue: GitHub.
Appendix: source
Thrown at packages/coding-agent/src/core/trust-manager.ts:166
const code =
typeof error === "object" && error !== null && "code" in error
? String((error as { code?: unknown }).code)
: undefined;
if (code !== "ELOCKED" || attempt === maxAttempts) {
throw error;
}
lastError = error;
const start = Date.now();
while (Date.now() - start < delayMs) {
// Sleep synchronously to avoid changing trust store callers to async.
}
}
}
if (lastError instanceof Error) {
throw lastError;
}
throw new Error("Failed to acquire trust store lock");
}
function withTrustFileLock<T>(path: string, fn: () => T): T {
const release = acquireTrustLockSync(path);
try {
return fn();
} finally {
release();
}
}
/**
* Returns true when cwd has project-local resources that must be gated by
* project trust: trust-requiring entries under cwd/.pi, or .agents/skills in
* cwd or one of its ancestors. Returns false when no such project resources
* exist. The user/global ~/.agents/skills directory is always treated as a
* trusted user resource and is ignored here, even when cwd is $HOME.
*/View on GitHub (pinned to 4af9d21d3b)