{"record":{"id":"561e023ba0d4022f","repo":"deepseek-ai/deepseek-harness","slug":"credential-ref-value-must-match-string-ref","errorCode":null,"errorMessage":"credential ref \"${value}\" must match ${String(REF_PATTERN)}","messagePattern":"credential ref \"(.+?)\" must match (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/credentials/credentials/src/index.ts","lineNumber":28,"sourceCode":"\nimport { Context, Service } from '@deepseek-ai/cordis'\nimport type { CredentialKey, CredentialRecord, CredentialRef } from './types.ts'\n\nexport type { ApiKeyRecord, CredentialKey, CredentialRecord, CredentialRef, GrantRecord } from './types.ts'\n\nconst REF_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/\n\n/** Both halves of a {@link CredentialKey}; the `/` between them is what keeps it out of {@link REF_PATTERN}. */\nconst KEY_SEGMENT_PATTERN = /^[a-z][a-z0-9-]*$/\n\n/**\n * Brand a raw string as a {@link CredentialRef}.\n * @param value - candidate reference; a POSIX shell identifier such as `DEEPSEEK_API_KEY`.\n * @returns the branded reference.\n */\nexport function credentialRef(value: string): CredentialRef {\n  if (!isCredentialRefName(value)) {\n    throw new TypeError(`credential ref \"${value}\" must match ${String(REF_PATTERN)}`)\n  }\n  return value as CredentialRef\n}\n\n/**\n * Whether a raw string could name a reference at all. Consumers that receive\n * environment-variable names from somewhere else — a provider library's own\n * ambient discovery, a hook payload — ask this before resolving, because a name\n * outside the grammar has no reference to miss and should read as \"not set\"\n * rather than as a thrown error.\n * @param value - candidate reference.\n * @returns true when {@link credentialRef} would accept it.\n */\nexport function isCredentialRefName(value: string): boolean {\n  return REF_PATTERN.test(value)\n}\n\n/**","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/credentials/credentials/src/index.ts#L10-L46","documentation":"Error \"credential ref \"${value}\" must match ${String(REF_PATTERN)}\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/credentials/credentials/src/index.ts:28 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}