deepseek-ai/deepseek-harness · error · SessionReferenceError

SESSION_REFERENCE_TOO_MANY

SESSION_REFERENCE_TOO_MANY

Error message

a message may reference at most ${maxReferences} sessions

What it means

Error "a message may reference at most ${maxReferences} sessions" thrown in deepseek-ai/deepseek-harness.

Source

Thrown at packages/context/session-reference/src/index.ts:327

  const seen = new Set<SessionId>()
  const normalized: Required<SessionReferenceInput>[] = []
  for (const candidate of references as readonly unknown[]) {
    if (typeof candidate !== 'object' || candidate === null) {
      throw new SessionReferenceError('session reference must be an object', 'SESSION_REFERENCE_INVALID_REFERENCE')
    }
    const reference = candidate as SessionReferenceInput
    if (typeof reference.sessionId !== 'string' || (reference.label !== undefined && typeof reference.label !== 'string')) {
      throw new SessionReferenceError('session reference must contain a string sessionId and optional string label', 'SESSION_REFERENCE_INVALID_REFERENCE')
    }
    if (reference.sessionId === targetId) {
      throw new SessionReferenceError(`session ${JSON.stringify(targetId)} cannot reference itself`, 'SESSION_REFERENCE_SELF_REFERENCE')
    }
    if (seen.has(reference.sessionId)) continue
    seen.add(reference.sessionId)
    normalized.push({ sessionId: reference.sessionId, label: reference.label ?? reference.sessionId })
  }
  if (normalized.length > maxReferences) {
    throw new SessionReferenceError(
      `a message may reference at most ${maxReferences} sessions`,
      'SESSION_REFERENCE_TOO_MANY',
    )
  }
  return normalized
}

function renderPrompt(data: readonly ReferencedSessionData[]): string {
  return `${PROMPT_PREFIX}${stringifyTagSafeJson(data)}${PROMPT_SUFFIX}`
}

function candidateRank(candidateCwd: string | undefined, targetCwd: string | undefined): number {
  if (candidateCwd !== undefined && targetCwd !== undefined && candidateCwd === targetCwd) return 0
  if (candidateCwd === undefined) return 1
  return 2
}

function assertNotCancelled(signal: AbortSignal | undefined): void {

View on GitHub (pinned to b150a551b8)

Solutions

  1. Reference at most the configured maximum number of sessions per message.

When it happens

Trigger: Thrown at packages/context/session-reference/src/index.ts:327 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of deepseek-ai/deepseek-harness@b150a551b8 (2026-08-24). Data as JSON: /api/errors/fc38446fe31610e6. Report an issue: GitHub.