deepseek-ai/deepseek-harness · error · Error
credentials-local is disposed: cannot modify
Error message
credentials-local is disposed: cannot modify "${key}" What it means
Lifecycle guard in modifyRecord: the credentials-local service is already disposed (plugin teardown finished), so the record mutation for the named key is refused. Writes after disposal would target a file the service no longer watches or locks.
Solutions
- Perform record mutations before the plugin/service disposes (e.g. within the plugin's lifecycle)
- Re-create the service in a fresh context instead of reusing a disposed handle
- Guard call sites that may outlive the plugin with a disposed check
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at packages/credentials/credentials-local/src/index.ts:678 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of deepseek-ai/deepseek-harness@b150a551b8 (2026-08-24).
Data as JSON: /api/errors/700e89ab1f9d8ec2.
Report an issue: GitHub.
Appendix: source
Thrown at packages/credentials/credentials-local/src/index.ts:678
// neither a key nor environment values is a deliberate statement rather
// than a blank.
if (stored === undefined) return Promise.resolve({ configured: false, writable: true })
return Promise.resolve({ configured: true, kind: stored.kind, writable: true })
}
override listRecords(): Promise<readonly CredentialRecordEntry[]> {
return Promise.resolve([...this.records].map(([key, record]) => ({
// The parser has already proven every stored key addressable.
key: parseCredentialKey(key),
kind: record.kind,
})))
}
override async modifyRecord(
key: CredentialKey,
mutate: (current: CredentialRecord | undefined) => Promise<CredentialRecord | undefined>,
): Promise<CredentialRecord | undefined> {
if (this.isClosed()) throw new Error(`credentials-local is disposed: cannot modify "${key}"`)
return this.enqueue(async () => {
if (this.isClosed()) {
throw new Error(`credentials-local was disposed before the queued "${key}" modify ran`)
}
await mkdir(dirname(this.spec.filename), { recursive: true, mode: 0o700 })
return withFileLock(this.spec.filename, async () => {
// Read-modify-write: `mutate` must decide against the record as it
// stands now, not as this process last saw it — another process may
// have rotated it since.
await this.reconcileFromDisk()
const current = this.records.get(key)
const next = await mutate(current)
if (next === undefined) return current
// Admitted before it is rendered: what the read path would refuse is
// refused here first, so a caller can never persist a document the
// next boot rejects, and a value refused here has not been stored.
if (next.kind === 'grant') assertJsonValue(`record "${key}" payload`, next.payload, new Set())
else assertStorableApiKey(key, next)View on GitHub (pinned to b150a551b8)