{"record":{"id":"ae555525522b821c","repo":"deepseek-ai/deepseek-harness","slug":"credentials-local-record-key-in-filename-ae5555","errorCode":null,"errorMessage":"credentials-local: record \"${key}\" in ${filename} has a non-string or empty key","messagePattern":"credentials-local: record \"(.+?)\" in (.+?) has a non-string or empty key","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/credentials/credentials-local/src/index.ts","lineNumber":339,"sourceCode":"  if (section === undefined || section === null) return {}\n  if (typeof section !== 'object' || Array.isArray(section)) {\n    throw new TypeError(`credentials-local: \"${name}\" in ${filename} must be a mapping`)\n  }\n  return section as Record<string, unknown>\n}\n\n/** Admit one record entry, rejecting an unknown tag or field rather than dropping it. */\nfunction parseRecord(key: string, value: unknown, filename: string): CredentialRecord {\n  if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n    throw new TypeError(`credentials-local: record \"${key}\" in ${filename} must be a mapping`)\n  }\n  const fields = value as Record<string, unknown>\n  const kind = fields['kind']\n  if (kind === 'api-key') {\n    assertFields(key, fields, ['kind', 'key', 'env'], filename)\n    const apiKey = fields['key']\n    if (apiKey !== undefined && (typeof apiKey !== 'string' || apiKey.length === 0)) {\n      throw new TypeError(`credentials-local: record \"${key}\" in ${filename} has a non-string or empty key`)\n    }\n    const env = parseRecordEnv(key, fields['env'], filename)\n    return {\n      kind: 'api-key',\n      ...apiKey === undefined ? {} : { key: apiKey },\n      ...env === undefined ? {} : { env },\n    }\n  }\n  if (kind === 'grant') {\n    assertFields(key, fields, ['kind', 'payload'], filename)\n    if (!('payload' in fields)) {\n      throw new Error(`credentials-local: record \"${key}\" in ${filename} has no payload`)\n    }\n    assertJsonValue(`record \"${key}\" payload in ${filename}`, fields['payload'], new Set())\n    return { kind: 'grant', payload: fields['payload'] }\n  }\n  if (kind === undefined) throw new Error(`credentials-local: record \"${key}\" in ${filename} has no kind`)\n  throw new Error(`credentials-local: record \"${key}\" in ${filename} has unknown kind ${JSON.stringify(kind)}`)","sourceCodeStart":321,"sourceCodeEnd":357,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/credentials/credentials-local/src/index.ts#L321-L357","documentation":"Field validation in parseRecord for api-key records: the `key` field is present but not a non-empty string. Key payloads are plain strings; wrong types or empty values are refused so a stored record never round-trips to garbage.","triggerScenarios":"Thrown at packages/credentials/credentials-local/src/index.ts:339 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the api-key record's key to a non-empty string","Quote the value if YAML parsed it as another type","Omit the field if the record holds only env entries"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}