deepseek-ai/deepseek-harness · error · TypeError

credentials-local: holds a non-finite number

Error message

credentials-local: ${where} holds a non-finite number

What it means

JSON round-trip validation in assertJsonValue: the payload (or a nested value) contains a non-finite number such as NaN, Infinity, or YAML's .inf. The seam promises exact round-trip of payloads, and JSON has no spelling for non-finite numbers; the subject is named without quoting any value.

Solutions

  1. Replace non-finite numbers with strings or omit them
  2. Fix YAML that spells .inf/.nan literals
  3. Sanitize owner-provided payloads (Numbers.isFinite) before storing
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

}

/**
 * Reject a payload that cannot survive a JSON round trip, on the way in and on
 * the way out. The seam promises owners their payload comes back exactly as
 * written, and both directions can break that: a document may spell `.inf` or
 * an alias cycle, and an owner may hand over a `Date`, a class instance, or a
 * `bigint` that this document has no faithful spelling for. Neither the value
 * nor any nested value is quoted in a diagnostic.
 * @param where - the subject named in a diagnostic, already free of any value.
 * @param value - the payload or nested value to admit.
 * @param seen - objects on the current path, for cycle detection.
 * @throws TypeError naming `where` when the value cannot round-trip.
 */
function assertJsonValue(where: string, value: unknown, seen: Set<object>): void {
  if (value === null || typeof value === 'string' || typeof value === 'boolean') return
  if (typeof value === 'number') {
    if (Number.isFinite(value)) return
    throw new TypeError(`credentials-local: ${where} holds a non-finite number`)
  }
  if (typeof value === 'object') {
    if (seen.has(value)) throw new TypeError(`credentials-local: ${where} is cyclic`)
    if (Object.getPrototypeOf(value) === Object.prototype || Array.isArray(value)) {
      seen.add(value)
      for (const nested of Object.values(value)) assertJsonValue(where, nested, seen)
      seen.delete(value)
      return
    }
  }
  throw new TypeError(`credentials-local: ${where} holds a value JSON cannot represent`)
}

/**
 * The comment-preserving mutable tree one edit renders from. Editing the
 * parsed document rather than rebuilding it keeps comments and the formatting
 * of every untouched entry; an absent document starts a fresh one.
 * @param text - the current document text, `undefined` while the file is absent.

View on GitHub (pinned to b150a551b8)