{"record":{"id":"8175828f9f5d8fe0","repo":"earendil-works/pi","slug":"state-stalemessage","errorCode":null,"errorMessage":"${state.staleMessage}","messagePattern":"\\$\\{state\\.staleMessage\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/core/extensions/loader.ts","lineNumber":187,"sourceCode":"\t\tclearExtensionCache();\n\t}\n\textensionCacheCwd = resolvedCwd;\n\treturn { cwd: resolvedCwd, generation: extensionCacheGeneration };\n}\n\n/**\n * Create a runtime with throwing stubs for action methods.\n * Runner.bindCore() replaces these with real implementations.\n */\nexport function createExtensionRuntime(): ExtensionRuntime {\n\tconst notInitialized = () => {\n\t\tthrow new Error(\"Extension runtime not initialized. Action methods cannot be called during extension loading.\");\n\t};\n\tconst state: { staleMessage?: string } = {};\n\tconst eventBusUnsubscribers = new Set<() => void>();\n\tconst assertActive = () => {\n\t\tif (state.staleMessage) {\n\t\t\tthrow new Error(state.staleMessage);\n\t\t}\n\t};\n\n\tconst runtime: ExtensionRuntime = {\n\t\tsendMessage: notInitialized,\n\t\tsendUserMessage: notInitialized,\n\t\tappendEntry: notInitialized,\n\t\tsetSessionName: notInitialized,\n\t\tgetSessionName: notInitialized,\n\t\tsetLabel: notInitialized,\n\t\tgetActiveTools: notInitialized,\n\t\tgetAllTools: notInitialized,\n\t\tsetActiveTools: notInitialized,\n\t\t// registerTool() is valid during extension load; refresh is only needed post-bind.\n\t\trefreshTools: () => {},\n\t\tgetCommands: notInitialized,\n\t\tsetModel: () => Promise.reject(new Error(\"Extension runtime not initialized\")),\n\t\tgetThinkingLevel: notInitialized,","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/coding-agent/src/core/extensions/loader.ts#L169-L205","documentation":"Generic staleness error from the loader runtime's assertActive: the extension API surface was used after the extension stopped being active. The exact reason is carried in state.staleMessage, set when the extension failed to load or was superseded; registration and event methods rethrow it.","triggerScenarios":"Thrown at packages/coding-agent/src/core/extensions/loader.ts:187 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Avoid using captured API objects after loading completes or fails","Register handlers during the loading phase only","Check extension load logs for the underlying failure that marked the API stale"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4af9d21d3b4d664e4a29fcabfec85171077248e3","analyzedAt":"2026-08-24T13:07:14.692Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}