vercel/ai · error · Error

${harnessId} cannot perform lossy ACP rerun without persiste

Error message

${harnessId} cannot perform lossy ACP rerun without persisted start configuration and an ACP session identifier.

What it means

A lossy rerun continues a turn by re-sending the persisted 'start' configuration with a recoveryMode of 'lossy-rerun', which requires both the persisted turn start config (latestTurnStartConfig) and the original ACP session id (latestACPSessionId). If either is missing — for example recovery never captured them — the harness cannot reconstruct the turn and throws.

Source

Thrown at packages/harness-acp/src/v1/acp-v1-harness.ts:1526

        if (options.responseFormat.schema == null) {
          throw unsupported({
            harnessId,
            message: `${harnessId} requires a JSON schema for structured output.`,
          });
        }
        if (outputSchemaMapping == null) {
          throw unsupported({
            harnessId,
            message: `${harnessId} does not support structured output through ACP.`,
          });
        }
      }
      if (!turnInFlight) {
        throw new Error(`${harnessId} has no in-flight ACP turn to continue.`);
      }
      if (lossyRerun) {
        if (latestTurnStartConfig == null || latestACPSessionId == null) {
          throw new Error(
            `${harnessId} cannot perform lossy ACP rerun without persisted start configuration and an ACP session identifier.`,
          );
        }
        assertRecoveryToolCatalog({
          persisted: latestTurnStartConfig.tools,
          current: options.tools ?? [],
        });
      }
      return wireTurn({
        emit: options.emit,
        abortSignal: options.abortSignal,
        start: () => {
          if (!lossyRerun) return;
          const turnStartConfig = latestTurnStartConfig!;
          channel.send({
            type: 'start',
            prompt: turnStartConfig.prompt,
            debug: turnStartConfig.debug,

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Ensure the persisted lifecycle data includes both turnStartConfig and acpSessionId before attempting a lossy-rerun continue.
  2. Fall back to a fresh promptTurn (replaying the original prompt) when the persisted start config is unavailable.
  3. Only attempt lossy rerun when the recovery status confirms the original turn had been started (start config was checkpointed).
  4. Re-create the session and re-send the original prompt if the persisted state cannot be completed.

Example fix

// before
await session.continueTurn({ tools }); // lossy rerun; throws if config/sessionId missing
// after
if (lifecycle.turnStartConfig && lifecycle.acpSessionId) {
  await session.continueTurn({ tools });
} else {
  await session.promptTurn({ prompt: originalPrompt, tools });
}
Defensive patterns

Strategy: validation

Validate before calling

function canLossyRerun(data) {
  return data?.turnStartConfig != null && data?.acpSessionId != null;
}
if (!canLossyRerun(lifecycleData)) { /* fall back to fresh promptTurn */ }

Type guard

function hasLossyRerunState(d: unknown): d is { turnStartConfig: object; acpSessionId: string } {
  return typeof d === 'object' && d !== null &&
    'turnStartConfig' in d && 'acpSessionId' in d;
}

Try / catch

try {
  await session.continueTurn({ tools });
} catch (e) {
  if (e instanceof Error && e.message.includes('lossy ACP rerun without persisted')) {
    await session.promptTurn({ prompt: originalPrompt, tools });
  } else throw e;
}

Prevention

When it happens

Trigger: Calling continueTurn with lossy rerun (recovery via bridge process loss) when lifecycle data lacks turnStartConfig or acpSessionId — e.g. recovery happened before the first 'start' was persisted, or the persisted state predates the first successful turn start.

Common situations: Restoring from an old or truncated persisted snapshot; a crash before the first turn start was checkpointed; resuming across hosts with partial lifecycle data; hand-constructed or migrated persisted state missing acpSessionId.

Related errors


AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30). Data as JSON: /api/errors/35db2e0b8da45641. Report an issue: GitHub.