{"record":{"id":"fc38446fe31610e6","repo":"deepseek-ai/deepseek-harness","slug":"session-reference-too-many","errorCode":"SESSION_REFERENCE_TOO_MANY","errorMessage":"a message may reference at most ${maxReferences} sessions","messagePattern":"a message may reference at most (.+?) sessions","errorType":"validation","errorClass":"SessionReferenceError","httpStatus":null,"severity":"error","filePath":"packages/context/session-reference/src/index.ts","lineNumber":327,"sourceCode":"  const seen = new Set<SessionId>()\n  const normalized: Required<SessionReferenceInput>[] = []\n  for (const candidate of references as readonly unknown[]) {\n    if (typeof candidate !== 'object' || candidate === null) {\n      throw new SessionReferenceError('session reference must be an object', 'SESSION_REFERENCE_INVALID_REFERENCE')\n    }\n    const reference = candidate as SessionReferenceInput\n    if (typeof reference.sessionId !== 'string' || (reference.label !== undefined && typeof reference.label !== 'string')) {\n      throw new SessionReferenceError('session reference must contain a string sessionId and optional string label', 'SESSION_REFERENCE_INVALID_REFERENCE')\n    }\n    if (reference.sessionId === targetId) {\n      throw new SessionReferenceError(`session ${JSON.stringify(targetId)} cannot reference itself`, 'SESSION_REFERENCE_SELF_REFERENCE')\n    }\n    if (seen.has(reference.sessionId)) continue\n    seen.add(reference.sessionId)\n    normalized.push({ sessionId: reference.sessionId, label: reference.label ?? reference.sessionId })\n  }\n  if (normalized.length > maxReferences) {\n    throw new SessionReferenceError(\n      `a message may reference at most ${maxReferences} sessions`,\n      'SESSION_REFERENCE_TOO_MANY',\n    )\n  }\n  return normalized\n}\n\nfunction renderPrompt(data: readonly ReferencedSessionData[]): string {\n  return `${PROMPT_PREFIX}${stringifyTagSafeJson(data)}${PROMPT_SUFFIX}`\n}\n\nfunction candidateRank(candidateCwd: string | undefined, targetCwd: string | undefined): number {\n  if (candidateCwd !== undefined && targetCwd !== undefined && candidateCwd === targetCwd) return 0\n  if (candidateCwd === undefined) return 1\n  return 2\n}\n\nfunction assertNotCancelled(signal: AbortSignal | undefined): void {","sourceCodeStart":309,"sourceCodeEnd":345,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/context/session-reference/src/index.ts#L309-L345","documentation":"Error \"a message may reference at most ${maxReferences} sessions\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/context/session-reference/src/index.ts:327 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reference at most the configured maximum number of sessions per message."],"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"}