{"record":{"id":"7d50258e429f71cf","repo":"vercel/ai","slug":"acp-lifecycle-state-data-is-missing","errorCode":null,"errorMessage":"ACP lifecycle state data is missing.","messagePattern":"ACP lifecycle state data is missing\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/harness-acp/src/v1/acp-v1-harness.ts","lineNumber":405,"sourceCode":"      const onDiagnostic = report\n        ? (frame: Parameters<typeof harnessV1DiagnosticFromBridgeFrame>[0]) =>\n            report(\n              harnessV1DiagnosticFromBridgeFrame(frame, {\n                sessionId: startOptions.sessionId,\n                timestamp: Date.now(),\n              }),\n            )\n        : undefined;\n      const onBridgeError = createBridgeErrorHandler({\n        harnessId: settings.harnessId,\n        sessionId: startOptions.sessionId,\n      });\n      const builtinToolCatalog = serializeBuiltinTools({ builtinTools });\n      let respawnStrategy: ACPRespawnStrategy | undefined;\n\n      if (isResume) {\n        if (lifecycleData == null) {\n          throw new Error('ACP lifecycle state data is missing.');\n        }\n        const coords = lifecycleData.bridge;\n        if (coords == null && isContinue) {\n          throw unsupported({\n            harnessId: settings.harnessId,\n            message:\n              'ACP continuation state does not contain bridge coordinates required for replay or process-loss rerun.',\n          });\n        }\n        if (coords != null) {\n          try {\n            const endpoint = await resolveBridgeEndpoint({\n              sandboxSession,\n              override: portEndpointOverride,\n              port: coords.port,\n              harnessId: settings.harnessId,\n            });\n            const attachEndpoint = withBridgeToken({","sourceCodeStart":387,"sourceCodeEnd":423,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/harness-acp/src/v1/acp-v1-harness.ts#L387-L423","documentation":"When the v1 harness starts in resume mode (isResume), it expects serialized lifecycle state from a previous run to be present. If lifecycleData is null/undefined the harness cannot restore the prior session and throws instead of silently starting fresh. This guards against resuming from missing or corrupted persisted state.","triggerScenarios":"Starting the harness with a resume/continue configuration while the lifecycle state blob passed in (or loaded from disk) is null — e.g. the state file was deleted, the wrong storage key was read, or resume was requested on a first run that never persisted state.","commonSituations":"Pointing resume at a fresh container/volume where prior state never existed; a failed previous run that crashed before persisting state; key collisions or env-specific state paths; manually clearing state directories then resuming.","solutions":["Start a fresh session instead of resuming when no prior state exists.","Verify the lifecycle state store/path actually contains data for this harnessId before resuming.","Ensure the previous run completed persisting state (check for crashes mid-write).","Pass the correct lifecycleData payload into the harness if you supply it programmatically."],"exampleFix":"// before\nharness.resume({ sessionId }); // throws: lifecycle state missing\n// after\nconst state = await loadLifecycleState(sessionId);\nif (state == null) {\n  await harness.start(); // fresh session\n} else {\n  await harness.resume({ sessionId });\n}","handlingStrategy":"validation","validationCode":"const state = await loadLifecycleState(sessionId);\nif (state == null) {\n  // no prior state: start fresh instead of resuming\n  await harness.start();\n} else {\n  await harness.resume({ sessionId });\n}","typeGuard":"function hasLifecycleState(s: unknown): s is NonNullable<typeof s> {\n  return s != null && typeof s === 'object' && 'bridge' in (s as object);\n}","tryCatchPattern":"try {\n  await harness.resume({ sessionId });\n} catch (error) {\n  if (error instanceof Error && error.message === 'ACP lifecycle state data is missing.') {\n    await harness.start(); // fall back to a fresh session\n  } else {\n    throw error;\n  }\n}","preventionTips":["Check state existence (fs.existsSync / store lookup) before requesting resume.","Ensure prior runs flush lifecycle state before process exit.","Use stable storage keys derived from a stable harnessId."],"tags":["state","resume","lifecycle","persistence"],"backgroundTag":"missing-session-state","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}