deepseek-ai/deepseek-harness · error · TypeError
credential ref "${value}" must match ${String(REF_PATTERN)}
Error message
credential ref "${value}" must match ${String(REF_PATTERN)} What it means
Error "credential ref "${value}" must match ${String(REF_PATTERN)}" thrown in deepseek-ai/deepseek-harness.
Source
Thrown at packages/credentials/credentials/src/index.ts:28
import { Context, Service } from '@deepseek-ai/cordis'
import type { CredentialKey, CredentialRecord, CredentialRef } from './types.ts'
export type { ApiKeyRecord, CredentialKey, CredentialRecord, CredentialRef, GrantRecord } from './types.ts'
const REF_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/
/** Both halves of a {@link CredentialKey}; the `/` between them is what keeps it out of {@link REF_PATTERN}. */
const KEY_SEGMENT_PATTERN = /^[a-z][a-z0-9-]*$/
/**
* Brand a raw string as a {@link CredentialRef}.
* @param value - candidate reference; a POSIX shell identifier such as `DEEPSEEK_API_KEY`.
* @returns the branded reference.
*/
export function credentialRef(value: string): CredentialRef {
if (!isCredentialRefName(value)) {
throw new TypeError(`credential ref "${value}" must match ${String(REF_PATTERN)}`)
}
return value as CredentialRef
}
/**
* Whether a raw string could name a reference at all. Consumers that receive
* environment-variable names from somewhere else — a provider library's own
* ambient discovery, a hook payload — ask this before resolving, because a name
* outside the grammar has no reference to miss and should read as "not set"
* rather than as a thrown error.
* @param value - candidate reference.
* @returns true when {@link credentialRef} would accept it.
*/
export function isCredentialRefName(value: string): boolean {
return REF_PATTERN.test(value)
}
/**View on GitHub (pinned to b150a551b8)
When it happens
Trigger: Thrown at packages/credentials/credentials/src/index.ts:28 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/561e023ba0d4022f.
Report an issue: GitHub.