{"record":{"id":"38cffb6260b83ea1","repo":"deepseek-ai/deepseek-harness","slug":"credential-key-segment-segment-must-match-s","errorCode":null,"errorMessage":"credential key segment \"${segment}\" must match ${String(KEY_SEGMENT_PATTERN)}","messagePattern":"credential key segment \"(.+?)\" must match (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/credentials/credentials/src/index.ts","lineNumber":69,"sourceCode":" * \"nothing stored\" rather than as a thrown error.\n * @param value - candidate segment.\n * @returns true when {@link credentialKey} would accept it as either segment.\n */\nexport function isCredentialKeySegment(value: string): boolean {\n  return KEY_SEGMENT_PATTERN.test(value)\n}\n\n/**\n * Brand a scope and an id as a {@link CredentialKey}.\n * @param scope - the owning plugin's registered name, such as `llm-pi-ai`.\n * @param id - that plugin's own addressing unit, such as a provider route key.\n * @returns the branded key.\n * @throws TypeError when either segment is not a lowercase hyphenated identifier.\n */\nexport function credentialKey(scope: string, id: string): CredentialKey {\n  for (const segment of [scope, id]) {\n    if (!KEY_SEGMENT_PATTERN.test(segment)) {\n      throw new TypeError(`credential key segment \"${segment}\" must match ${String(KEY_SEGMENT_PATTERN)}`)\n    }\n  }\n  return `${scope}/${id}` as CredentialKey\n}\n\n/**\n * Brand a stored `<scope>/<id>` string as a {@link CredentialKey}. This is the\n * read half of {@link credentialKey}, for a provider admitting keys off disk.\n * @param value - candidate key in its joined form.\n * @returns the branded key.\n * @throws TypeError when the value is not exactly two valid segments.\n */\nexport function parseCredentialKey(value: string): CredentialKey {\n  const segments = value.split('/')\n  const [scope, id] = segments\n  if (segments.length !== 2 || scope === undefined || id === undefined) {\n    throw new TypeError(`credential key \"${value}\" must be \"<scope>/<id>\"`)\n  }","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/credentials/credentials/src/index.ts#L51-L87","documentation":"Error \"credential key segment \"${segment}\" must match ${String(KEY_SEGMENT_PATTERN)}\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/credentials/credentials/src/index.ts:69 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"}