{"record":{"id":"d286776f4635023c","repo":"paperclipai/paperclip","slug":"native-runner-prp-run-rotation-failed","errorCode":null,"errorMessage":"native_runner_prp_run_rotation_failed","messagePattern":"native_runner_prp_run_rotation_failed","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/paperclip-runner/src/live/runnerd-codex-transport.ts","lineNumber":3660,"sourceCode":"            this.#authorizedTools,\n            this.options.resumeCompletionContract,\n          )\n        : rotatedRunAttachPayload(\n            core.store.state,\n            desired,\n            this.#authorizedTools,\n            this.options.resumeCompletionContract,\n          );\n      this.#runAttachTemplate = structuredClone(runAttachTemplate);\n      const payload = {\n        ...runAttachTemplate,\n        paperclipNextAuthority: { identity: desired, connection },\n      };\n      core.queueCommand(\"run.attach\", payload, commandId, true);\n      await this.#waitCommand(\"run.attach\", commandId);\n      const attached = core.getCommand(commandId);\n      if (attached?.status !== \"completed\") {\n        throw new Error(\"native_runner_prp_run_rotation_failed\");\n      }\n\n      activationStarted = true;\n      core.rotateRunIdentity(desired, runAttachTemplate);\n      await registration?.activate?.();\n      if (registration?.failure) {\n        void registration.failure.catch((error: unknown) => {\n          this.#failTransport(\n            error instanceof Error ? error : new Error(String(error)),\n          );\n        });\n      }\n      await this.#awaitRegistrationReady(registration?.ready);\n      const activationDeadline =\n        Date.now() + (this.options.runnerReconnectGraceMs ?? 5_000);\n      while (\n        !recoveryIdentityMatches(core.store.state.identity, desired) ||\n        core.store.state.warmTransition !== undefined ||","sourceCodeStart":3642,"sourceCodeEnd":3678,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/packages/paperclip-runner/src/live/runnerd-codex-transport.ts#L3642-L3678","documentation":"attachRun sends a 'run.attach' command to the runner core and waits for it to complete. If the command finishes with any status other than 'completed', the run rotation failed and this error is thrown. It signals the runner rejected or failed the durable identity rotation for the run.","triggerScenarios":"core.getCommand(commandId).status is 'failed' or otherwise non-completed after #waitCommand resolves for the 'run.attach' payload — e.g. the runner rejected the desired DurableRecoveryIdentity or the attach handler errored.","commonSituations":"Runner-side attach failure due to invalid runId/turnId/itemId; runner state incompatible with the desired identity; protocol mismatch between transport and runner versions.","solutions":["Inspect runner logs for why the run.attach command failed","Verify runId/turnId/itemId are valid and match an existing run on the runner","Ensure transport and runner versions agree on the run.attach protocol","Retry the attach after fixing the runner-side cause"],"exampleFix":"// before\nawait transport.attachRun({ runId: staleRunId, turnId, itemId });\n// after\nconst run = await resolveRun(staleRunId);\nif (!run) throw new Error(`run ${staleRunId} not found on runner`);\nawait transport.attachRun({ runId: run.id, turnId, itemId });","handlingStrategy":"try-catch","validationCode":"if (!runId || !turnId || !itemId) throw new Error('attachRun requires runId, turnId, itemId');","typeGuard":null,"tryCatchPattern":"try {\n  await transport.attachRun({ runId, turnId, itemId });\n} catch (e) {\n  if (e.message === 'native_runner_prp_run_rotation_failed') {\n    const detail = await fetchRunnerAttachFailure(runId);\n    logger.error('run.attach rejected by runner', detail);\n    throw new Error(`run rotation failed: ${detail}`);\n  } else throw e;\n}","preventionTips":["Validate runId/turnId/itemId against the runner's known state before attaching","Keep transport and runner versions in lockstep","Log command IDs so runner-side attach failures can be correlated"],"tags":["codex","native-runner","run-attach","command-failed"],"backgroundTag":"internal-invariant-violation","analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-09-10T03:14:50.855Z","contentChangedAt":"2026-09-10T03:14:50.855Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}