{"record":{"id":"1abe38527f3e5fe2","repo":"github/copilot-sdk","slug":"copilotclient-is-in-mode-empty-but-the-session","errorCode":null,"errorMessage":"CopilotClient is in mode: 'empty' but the session config did not specify 'availableTools'. Empty mode requires every session to explicitly opt into the tools it wants — e.g. `new ToolSet().addBuiltIn(BuiltInTools.Isolated)`.","messagePattern":"CopilotClient is in mode: 'empty' but the session config did not specify 'availableTools'\\. Empty mode requires every session to explicitly opt into the tools it wants — e\\.g\\. `new ToolSet\\(\\)\\.addBuiltIn\\(BuiltInTools\\.Isolated\\)`\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nodejs/src/client.ts","lineNumber":1376,"sourceCode":"     *\n     * @internal\n     */\n    private resolveToolFilterOptions(config: {\n        availableTools?: string[] | ToolSet;\n        excludedTools?: string[] | ToolSet;\n    }): {\n        availableTools: string[] | undefined;\n        excludedTools: string[] | undefined;\n        toolFilterPrecedence: \"excluded\";\n    } {\n        const availableTools = toolFilterListToArray(config.availableTools);\n        const excludedTools = toolFilterListToArray(config.excludedTools);\n        validateToolFilterList(\"availableTools\", availableTools);\n        validateToolFilterList(\"excludedTools\", excludedTools);\n\n        if (this.options.mode === \"empty\") {\n            if (availableTools === undefined) {\n                throw new Error(\n                    \"CopilotClient is in mode: 'empty' but the session config did not \" +\n                        \"specify 'availableTools'. Empty mode requires every session to \" +\n                        \"explicitly opt into the tools it wants — e.g. \" +\n                        \"`new ToolSet().addBuiltIn(BuiltInTools.Isolated)`.\"\n                );\n            }\n        }\n\n        return { availableTools, excludedTools, toolFilterPrecedence: \"excluded\" };\n    }\n\n    /** Mode-specific defaults spread under the caller's config (app values win). */\n    private configDefaultsForMode(): Partial<SessionConfigBase> {\n        if (this.options.mode === \"empty\") {\n            return {\n                enableSessionTelemetry: false,\n                mcpOAuthTokenStorage: \"in-memory\",\n                skipEmbeddingRetrieval: true,","sourceCodeStart":1358,"sourceCodeEnd":1394,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/nodejs/src/client.ts#L1358-L1394","documentation":"Error \"CopilotClient is in mode: 'empty' but the session config did not specify 'availableTools'. Empty mode requires every session to explicitly opt into the tools it wants — e.g. `new ToolSet().addBuiltIn(BuiltInTools.Isolated)`.\" thrown in github/copilot-sdk.","triggerScenarios":"Thrown at nodejs/src/client.ts:1376 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass availableTools in the per-session config, e.g. new ToolSet().addBuiltIn(BuiltInTools.Isolated), converted to a list as required","Do not assume empty mode inherits default tools — every session must explicitly opt in","If all sessions should share a toolset, build the ToolSet once and reference it in each createSession call"],"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"}