deepseek-ai/deepseek-harness · error · TypeError

credentials-local: record "${key}" has an empty key; omit th

Error message

credentials-local: record "${key}" has an empty key; omit the field instead

What it means

Error "credentials-local: record "${key}" has an empty key; omit the field instead" thrown in deepseek-ai/deepseek-harness.

Source

Thrown at packages/credentials/credentials-local/src/index.ts:309

  const entries = new Map<string, CredentialRecord>()
  for (const [key, value] of Object.entries(asSection(section, 'records', filename))) {
    parseCredentialKey(key)
    entries.set(key, parseRecord(key, value, filename))
  }
  return entries
}

/**
 * Refuse an api-key record the read path could not admit, before it is
 * rendered: an empty key, an env name outside the reference grammar, or an
 * empty env value would persist a document `parseRecord` rejects at the next
 * boot — a durable-boundary write is validated where it is written.
 * @param key - the record's credential key, for the failure message.
 * @param record - the api-key record a mutation returned.
 */
function assertStorableApiKey(key: CredentialKey, record: ApiKeyRecord): void {
  if (record.key !== undefined && record.key.length === 0) {
    throw new TypeError(`credentials-local: record "${key}" has an empty key; omit the field instead`)
  }
  for (const [name, value] of Object.entries(record.env ?? {})) {
    credentialRef(name)
    if (value.length === 0) {
      throw new TypeError(`credentials-local: record "${key}" env "${name}" must be a non-empty string`)
    }
  }
}

/** One section of the document as a plain mapping; absent and null both mean empty. */
function asSection(section: unknown, name: string, filename: string): Record<string, unknown> {
  if (section === undefined || section === null) return {}
  if (typeof section !== 'object' || Array.isArray(section)) {
    throw new TypeError(`credentials-local: "${name}" in ${filename} must be a mapping`)
  }
  return section as Record<string, unknown>
}

View on GitHub (pinned to b150a551b8)

When it happens

Trigger: Thrown at packages/credentials/credentials-local/src/index.ts:309 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/e3d9ee57f4017d54. Report an issue: GitHub.