deepseek-ai/deepseek-harness · error · TypeError

credential key " " must be " /

Error message

credential key "${value}" must be "<scope>/<id>"

What it means

Grammar validation in parseCredentialKey (read half of credentialKey): the joined '<scope>/<id>' string is not exactly two valid lowercase-hyphenated segments. This fires when a key read off disk or from a provider is malformed — wrong separator count, empty segment, or invalid characters.

Solutions

  1. Write the key as exactly '<scope>/<id>' with valid lowercase hyphenated segments
  2. Fix malformed keys in the stored document
  3. Build keys via credentialKey() instead of hand-joining strings
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/credentials/credentials/src/index.ts:86 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/400beb897f1d89a5. Report an issue: GitHub.

Appendix: source

Thrown at packages/credentials/credentials/src/index.ts:86

    if (!KEY_SEGMENT_PATTERN.test(segment)) {
      throw new TypeError(`credential key segment "${segment}" must match ${String(KEY_SEGMENT_PATTERN)}`)
    }
  }
  return `${scope}/${id}` as CredentialKey
}

/**
 * Brand a stored `<scope>/<id>` string as a {@link CredentialKey}. This is the
 * read half of {@link credentialKey}, for a provider admitting keys off disk.
 * @param value - candidate key in its joined form.
 * @returns the branded key.
 * @throws TypeError when the value is not exactly two valid segments.
 */
export function parseCredentialKey(value: string): CredentialKey {
  const segments = value.split('/')
  const [scope, id] = segments
  if (segments.length !== 2 || scope === undefined || id === undefined) {
    throw new TypeError(`credential key "${value}" must be "<scope>/<id>"`)
  }
  return credentialKey(scope, id)
}

/**
 * The owning plugin's name for one key. A record whose scope names no
 * currently registered owner is an orphan, which a configuration surface must
 * report as such rather than as a working credential.
 * @param key - the key to read.
 * @returns the scope segment.
 */
export function credentialKeyScope(key: CredentialKey): string {
  // The brand's only constructors both validate two segments, so the split
  // cannot come back short here.
  return key.slice(0, key.indexOf('/'))
}

/**

View on GitHub (pinned to b150a551b8)