{"record":{"id":"f89c3f6788c96f13","repo":"github/copilot-sdk","slug":"in-process-ffi-runtime-host-not-started","errorCode":null,"errorMessage":"In-process FFI runtime host not started","messagePattern":"In-process FFI runtime host not started","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nodejs/src/client.ts","lineNumber":2858,"sourceCode":"        if (this.options.sessionIdleTimeoutSeconds > 0) {\n            args.push(\"--session-idle-timeout\", this.options.sessionIdleTimeoutSeconds.toString());\n        }\n        if (this.options.enableRemoteSessions) {\n            args.push(\"--remote\");\n        }\n\n        const host = FfiRuntimeHost.create(runtimeLibrary, explicitEntrypoint, environment, args);\n        this.ffiHost = host;\n        await host.start();\n    }\n\n    /**\n     * Connect to the in-process FFI runtime host over its receive/send streams,\n     * reusing the same `vscode-jsonrpc` framing as the stdio transport.\n     */\n    private async connectViaFfi(): Promise<void> {\n        if (!this.ffiHost) {\n            throw new Error(\"In-process FFI runtime host not started\");\n        }\n        this.messageWriter = new TeardownResilientStreamMessageWriter(this.ffiHost.sendStream);\n        this.connection = createMessageConnection(\n            new StreamMessageReader(this.ffiHost.receiveStream),\n            this.messageWriter\n        );\n\n        this.attachConnectionHandlers();\n        this.connection.listen();\n    }\n\n    private static getNapiPrebuildsFolder(entrypoint: string): string {\n        const arch = process.arch;\n        if (arch !== \"x64\" && arch !== \"arm64\") {\n            throw new Error(`Unsupported architecture '${arch}' for in-process FFI hosting.`);\n        }\n        let platform: string = process.platform;\n        if (platform === \"linux\" && CopilotClient.isMusl(entrypoint)) {","sourceCodeStart":2840,"sourceCodeEnd":2876,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/nodejs/src/client.ts#L2840-L2876","documentation":"State guard in CopilotClient: code tried to use the in-process FFI runtime host (this.ffiHost) before FfiRuntimeHost.start() completed or after it failed/stopped. The receive/send streams needed for JSON-RPC framing do not exist until the host is running, so the client has no transport.","triggerScenarios":"Thrown at nodejs/src/client.ts:2858 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Await the client's connect/start flow that creates and starts the FFI host before issuing any requests","Check that the runtime library loaded correctly (correct platform artifact and entrypoint) - a failed start leaves the host unset","Fall back to the stdio or TCP transport if the FFI runtime library is unavailable on this platform"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}