{"record":{"id":"f3ebd2ee42835506","repo":"paperclipai/paperclip","slug":"acpx-session-profile-differs-from-its-initializati","errorCode":null,"errorMessage":"ACPX session profile differs from its initialization","messagePattern":"ACPX session profile differs from its initialization","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/paperclip-runner/src/cli/acpx-runtime-sidecar.ts","lineNumber":253,"sourceCode":"    };\n  }\n  if (request.command === \"session.open\") {\n    if (\n      hasSidecarSessionOwnership(\n        host,\n        activeHostCleanup,\n        failedAdmissionCleanup,\n      )\n    ) {\n      throw new Error(\"ACPX sidecar already owns a session or its cleanup\");\n    }\n    if (!initializedModel) throw new Error(\"initialize the ACPX sidecar first\");\n    const params = parseOpenParams(request.params);\n    if (\n      params.agent !== initializedAgent ||\n      params.model !== initializedModel\n    ) {\n      throw new Error(\"ACPX session profile differs from its initialization\");\n    }\n    const openedHost = await AcpxRuntimeHost.open(\n      {\n        runtimeDirectory: params.runtimeDirectory,\n        normalizedSessionId: params.normalizedSessionId,\n        workingDirectory: params.workingDirectory,\n        agent: params.agent,\n        model: params.model,\n        permissionMode: params.permissionMode,\n        systemInstructions: params.systemInstructions,\n        environment: process.env,\n        expectedIdentity: params.expectedIdentity,\n        semanticTools: {\n          tools: params.tools,\n          handler: waitForTool,\n        },\n        onGoalUpdate: (goal) => {\n          // Admission can emit a snapshot before the verified host is assigned.","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/packages/paperclip-runner/src/cli/acpx-runtime-sidecar.ts#L235-L271","documentation":"After initialization, the ACPX sidecar validates that each session/open request's agent and model match the agent/model it was initialized with. If parsed params differ from initializedAgent or initializedModel, dispatch throws this error because one sidecar process is bound to exactly one session profile.","triggerScenarios":"Calling session/open with params.agent or params.model different from the values passed at initialize; a client reconnecting with changed defaults; passing stale cached params after the client's model selection changed.","commonSituations":"Switching models in the UI while reusing a long-lived sidecar; config reload changing the default model after sidecar startup; multiple agents sharing one sidecar process; copy-pasted open params from another session.","solutions":["Restart/re-initialize the sidecar with the desired agent+model before opening sessions with that profile","Send open params that exactly match the initialized agent and model (log both sides to compare)","If the profile must change, tear down the current sidecar and spawn a new one bound to the new profile","Cache the initialized profile client-side and validate before dispatch"],"exampleFix":"// before\nsidecar.dispatch({ method: 'session/open', params: { agent, model: 'other-model' } });\n// after\nif (model !== sidecar.initializedProfile.model) {\n  await sidecar.restart({ agent, model }); // re-init with new profile\n}\nsidecar.dispatch({ method: 'session/open', params: { agent, model } });","handlingStrategy":"validation","validationCode":"if (params.agent !== initializedProfile.agent || params.model !== initializedProfile.model) await respawnSidecar({ agent: params.agent, model: params.model });","typeGuard":"const matchesProfile = (p: { agent: string; model: string }, init: { agent: string; model: string }) => p.agent === init.agent && p.model === init.model;","tryCatchPattern":"try { sidecar.dispatch(openRequest); } catch (e) { if (e.message === 'ACPX session profile differs from its initialization') { await respawnSidecar(openRequest.params); return sidecar.dispatch(openRequest); } throw e; }","preventionTips":["Cache the initialized agent/model and compare before each open","Restart the sidecar whenever the desired profile changes","Never share one sidecar process across different agent profiles"],"tags":["sidecar","acpx","profile-mismatch"],"backgroundTag":"invalid-argument-value","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"}