{"record":{"id":"7a77a9d31fd96661","repo":"vercel/ai","slug":"acp-session-initialization-did-not-start-stderr-mo","errorCode":null,"errorMessage":"ACP session initialization did not start stderr monitoring.","messagePattern":"ACP session initialization did not start stderr monitoring\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/harness-acp/src/v1/bridge/index.ts","lineNumber":156,"sourceCode":"  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 });\n    turn.bridgeLog({\n      level: 'warn',\n      subsystem: 'acp.recovery',\n      message:","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/harness-acp/src/v1/bridge/index.ts#L138-L174","documentation":"runTurn requires that session initialization started stderr monitoring for the agent process; the agentResponseStreamFailure variable is assigned by that setup and asserted non-null. If it is still null, the bridge assumes stderr monitoring was never wired up and throws this Error, since agent-side failure output would otherwise be lost.","triggerScenarios":"The post-initialization path in runTurn where the agentResponseStreamFailure sentinel was not set — i.e. the code that begins consuming the agent process's stderr stream never ran or never recorded its failure slot, even though a session was produced.","commonSituations":"Internal bridge bug where the stderr-monitoring setup was skipped or its assignment raced; an agent adapter that does not expose a stderr stream; regression after refactoring the initialization sequence so monitoring is started after this assertion.","solutions":["Verify that the stderr monitoring setup runs during session initialization and assigns agentResponseStreamFailure before runTurn proceeds.","Check for ordering or race issues between session creation and stderr stream attachment and fix the sequencing.","File/debug as a bridge bug if the stock ACP agent triggers it — user configuration cannot normally cause this error."],"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 start stderr monitoring')) {\n    // treat as bridge/adapter bug; report with agent and bridge versions\n  }\n  throw error;\n}","preventionTips":["Keep harness-acp and the agent adapter on compatible versions.","Avoid custom agent adapters that omit a stderr stream.","Report persistent occurrences upstream — user config cannot normally cause this."],"tags":["acp","stderr","initialization","internal"],"backgroundTag":"acp-stderr-monitor-not-started","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}