{"record":{"id":"e3e7b656baa268df","repo":"deepseek-ai/deepseek-harness","slug":"session-reference-invalid-reference-e3e7b6","errorCode":"SESSION_REFERENCE_INVALID_REFERENCE","errorMessage":"invalid session reference URI ${JSON.stringify(uri)}","messagePattern":"invalid session reference URI (.+?)","errorType":"validation","errorClass":"SessionReferenceError","httpStatus":null,"severity":"error","filePath":"packages/context/session-reference/src/uri.ts","lineNumber":27,"sourceCode":"\n/**\n * Encode any JavaScript session-id string as a canonical lossless URI.\n * @param sessionId - opaque session id to serialize.\n * @returns canonical `dsh-session:` URI.\n */\nexport function encodeSessionReferenceUri(sessionId: SessionIdType): string {\n  const payload = Buffer.from(JSON.stringify(sessionId), 'utf8').toString('base64url')\n  return `${SESSION_REFERENCE_SCHEME}${payload}`\n}\n\n/**\n * Decode and canonicalize one session-reference URI.\n * @param uri - complete canonical URI.\n * @returns decoded session id.\n */\nexport function decodeSessionReferenceUri(uri: string): SessionIdType {\n  if (!uri.startsWith(SESSION_REFERENCE_SCHEME)) {\n    throw invalidUri(uri)\n  }\n  const payload = uri.slice(SESSION_REFERENCE_SCHEME.length)\n  if (!/^[A-Za-z0-9_-]+$/.test(payload)) throw invalidUri(uri)\n  try {\n    const parsed: unknown = JSON.parse(Buffer.from(payload, 'base64url').toString('utf8'))\n    if (typeof parsed !== 'string') throw new TypeError('decoded session id is not a string')\n    const sessionId = SessionId(parsed)\n    if (encodeSessionReferenceUri(sessionId) !== uri) throw new TypeError('URI is not canonical')\n    return sessionId\n  } catch (error: unknown) {\n    throw invalidUri(uri, error)\n  }\n}\n\n/**\n * Render a host-neutral Markdown mention carrying the canonical URI.\n * @param reference - structured id and optional display label.\n * @returns escaped `@[label](uri)` mention.","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/context/session-reference/src/uri.ts#L9-L45","documentation":"Error \"invalid session reference URI ${JSON.stringify(uri)}\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/context/session-reference/src/uri.ts:27 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a well-formed session reference URI matching the expected scheme."],"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"}