{"record":{"id":"367786b02cc80154","repo":"paperclipai/paperclip","slug":"native-execution-input-persisted-binding-mismatch","errorCode":"native_execution_input_persisted_binding_mismatch","errorMessage":"native_execution_input_persisted_binding_mismatch","messagePattern":"native_execution_input_persisted_binding_mismatch","errorType":"error_code","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/src/services/native-runtime/native-session-resume.ts","lineNumber":286,"sourceCode":"      nativeSessionId: string | null;\n    };\n    selectedSessionId: string;\n    execution: NativeExecutionInput;\n    restoringCheckpoint: boolean;\n  },\n) {\n  const hasProviderEvents = (\n    await nativeSessionProviderEvidence(db, [input.run.id])\n  ).has(input.run.id);\n  const profile = record(input.run.runnerProfileJson);\n  if (\n    profile.nativeExecutionInput !== undefined &&\n    !isDeepStrictEqual(\n      parseNativeExecutionInput(profile.nativeExecutionInput),\n      input.execution,\n    )\n  ) {\n    throw new Error(\"native_execution_input_persisted_binding_mismatch\");\n  }\n  if (\n    input.restoringCheckpoint &&\n    !isUnusedNativeSessionBootstrap(input.run, hasProviderEvents)\n  ) {\n    throw new Error(\"native_session_bootstrap_identity_conflict\");\n  }\n  return nativeSessionIdForBootstrapPersistence({\n    ...input,\n    hasProviderEvents,\n  });\n}\n\n/**\n * Legacy compatibility is deliberately narrower than ordinary task-session\n * continuation: only a replacement row that never acquired any native process\n * or provider authority may be rebound to a terminal native source. The exact\n * checkpoint/session/workspace/provider binding is validated separately by","sourceCodeStart":268,"sourceCodeEnd":304,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/server/src/services/native-runtime/native-session-resume.ts#L268-L304","documentation":"prepareNativeSessionBootstrapPersistence compares the run's persisted runnerProfileJson.nativeExecutionInput against the execution input currently being persisted. Once a run has recorded its native execution input (prompt model, cwd, settings, etc.), that binding is immutable. This error means the caller is trying to bind a different native execution configuration to a run that already has one.","triggerScenarios":"prepareNativeSessionBootstrapPersistence is called and profile.nativeExecutionInput !== undefined while isDeepStrictEqual(parseNativeExecutionInput(profile.nativeExecutionInput), input.execution) is false — i.e., the run row already stores a nativeExecutionInput that deep-inequality-compares with the supplied execution object.","commonSituations":"Re-running bootstrap with changed prompt/model/cwd/settings for the same run; resuming a run with execution input serialized in a different key order or with extra fields; passing a different run row that was bootstrapped for a different execution; a code change altering the NativeExecutionInput shape so deep-equality breaks against old persisted profiles.","solutions":["Ensure input.execution matches the persisted profile exactly; reuse the run's existing nativeExecutionInput when re-invoking.","Start a new run when the execution input (prompt, cwd, model) differs instead of rebinding the existing run.","Normalize/validate the execution object before comparison so key ordering and optional fields serialize identically.","Inspect the run's runnerProfileJson to see the stored binding and reconcile the caller with it."],"exampleFix":"// before\nprepareNativeSessionBootstrapPersistence(db, { run, selectedSessionId, execution: { prompt, cwd, settings: newSettings }, restoringCheckpoint: false });\n// after\nconst execution = parseNativeExecutionInput(record(run.runnerProfileJson).nativeExecutionInput) ?? { prompt, cwd, settings: newSettings };\nprepareNativeSessionBootstrapPersistence(db, { run, selectedSessionId, execution, restoringCheckpoint: false });","handlingStrategy":"validation","validationCode":"function matchesPersistedExecution(run, execution) {\n  const profile = record(run.runnerProfileJson);\n  if (profile.nativeExecutionInput === undefined) return true;\n  return isDeepStrictEqual(parseNativeExecutionInput(profile.nativeExecutionInput), execution);\n}","typeGuard":"const isCompatibleRun = (run, execution) => record(run.runnerProfileJson).nativeExecutionInput === undefined || isDeepStrictEqual(parseNativeExecutionInput(record(run.runnerProfileJson).nativeExecutionInput), execution);","tryCatchPattern":"try {\n  await prepareNativeSessionBootstrapPersistence(db, { run, selectedSessionId, execution, restoringCheckpoint });\n} catch (e) {\n  if (e.message === \"native_execution_input_persisted_binding_mismatch\") {\n    // rebind onto a fresh run with the new execution input\n    return createRunWithExecution(execution);\n  }\n  throw e;\n}","preventionTips":["Reuse the persisted nativeExecutionInput whenever re-invoking bootstrap on the same run.","Serialize NativeExecutionInput deterministically (fixed key order, normalized optionals) before persistence and comparison.","Create a new run whenever prompt/model/cwd/settings change.","Add a pre-check comparing the intended execution against runnerProfileJson before calling the API."],"tags":["native-runtime","immutability","config-mismatch","deep-equality"],"backgroundTag":"conflicting-config-options","analyzedSha":"3f1d897a7c018d76563a21c6e39c3c9b03933622","analyzedAt":"2026-09-18T08:03:59.046Z","contentChangedAt":"2026-09-18T08:03:59.046Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}