{"record":{"id":"1f2f5e1edeb6824f","repo":"vercel/ai","slug":"acp-session-initialization-did-not-produce-a-sessi","errorCode":null,"errorMessage":"ACP session initialization did not produce a session.","messagePattern":"ACP session initialization did not produce a session\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/harness-acp/src/v1/bridge/index.ts","lineNumber":152,"sourceCode":"});\n\nasync function runTurn(start: StartMessage, turn: BridgeTurn): Promise<void> {\n  let initialHostToolCatalogRefreshRequired: boolean;\n  try {\n    ({ initialHostToolCatalogRefreshRequired } = await ensureSession({\n      start,\n      turn,\n    }));\n  } catch (error) {\n    if (HarnessBridgeCapabilityUnsupportedError.isInstance(error)) throw error;\n    throw createACPBridgeError({\n      stage: 'session initialization',\n      cause: error,\n    });\n  }\n  const activeSession = session;\n  if (activeSession == null) {\n    throw new Error('ACP session initialization did not produce a session.');\n  }\n  const activeAgentResponseStreamFailure = agentResponseStreamFailure;\n  if (activeAgentResponseStreamFailure == null) {\n    throw new Error(\n      'ACP session initialization did not start stderr monitoring.',\n    );\n  }\n  const activeHostToolRelay = hostToolRelay;\n  if (activeHostToolRelay == null) {\n    throw new Error('The host tool MCP relay is unavailable.');\n  }\n  if (start.recoveryMode?.type === 'lossy-rerun') {\n    const marker = {\n      type: 'acp-recovery',\n      mode: 'lossy-rerun',\n      reason: start.recoveryMode.reason,\n    } as const;\n    turn.emit({ type: 'raw', rawValue: marker });","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/harness-acp/src/v1/bridge/index.ts#L134-L170","documentation":"After ACP session initialization completes inside runTurn, the bridge asserts that the session variable was actually assigned; if it is still null/undefined, this Error is thrown because a turn cannot proceed without an ACP session id. Normally the initialize handshake produces a session; hitting this means the handshake silently completed without one, indicating a bug or an unexpected agent response shape.","triggerScenarios":"The ACP agent's initialize/newSession handshake resolves (or the wrapped failure path is entered) without the session variable being populated before runTurn continues to execute the turn.","commonSituations":"A buggy or non-conformant ACP agent binary that replies to session/new without a sessionId; an agent that exits immediately so initialization resolves abnormally; wrapping a custom agent that implements the ACP protocol incorrectly.","solutions":["Inspect the agent's response to session initialization and confirm it returns a valid sessionId.","Update or fix the ACP agent binary/adapter so it conforms to the ACP session/new response schema.","Capture the agent's stderr/stdout during startup to see whether the agent crashed or mis-responded during initialization."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await bridge.runTurn({ prompt });\n} catch (error) {\n  if (error instanceof Error && error.message.includes('did not produce a session')) {\n    // inspect agent initialization response / restart the agent\n  }\n  throw error;\n}","preventionTips":["Use a conformant, up-to-date ACP agent binary.","Capture agent stderr/stdout during startup to catch protocol deviations early.","Smoke-test session initialization before running full turns."],"tags":["acp","session","initialization","protocol"],"backgroundTag":"acp-session-init-failed","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}