{"record":{"id":"a2cccfd9016040b4","repo":"github/copilot-sdk","slug":"copilotclient-was-created-with-mode-empty-but-n","errorCode":null,"errorMessage":"CopilotClient was created with mode: 'empty' but neither 'baseDirectory' nor 'sessionFs' was set. Empty mode requires an explicit per-session persistence location; pick one.","messagePattern":"CopilotClient was created with mode: 'empty' but neither 'baseDirectory' nor 'sessionFs' was set\\. Empty mode requires an explicit per-session persistence location; pick one\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nodejs/src/client.ts","lineNumber":740,"sourceCode":"            enableRemoteSessions: options.enableRemoteSessions ?? false,\n            mode: options.mode ?? \"copilot-cli\",\n            clientInfo: options.clientInfo,\n        };\n\n        // Empty mode: validate at construction time that the app supplied a\n        // per-session persistence location. The runtime is mode-agnostic, so\n        // without this check it would silently fall back to ~/.copilot, which\n        // defeats the point of empty mode for multi-tenant scenarios.\n        if (this.options.mode === \"empty\") {\n            const hasPersistence =\n                this.options.baseDirectory !== undefined ||\n                this.sessionFsConfig !== null ||\n                // External runtimes manage their own persistence layer; the SDK\n                // can't enforce it from here.\n                conn.kind === \"uri\" ||\n                conn.kind === \"parent-process\";\n            if (!hasPersistence) {\n                throw new Error(\n                    \"CopilotClient was created with mode: 'empty' but neither \" +\n                        \"'baseDirectory' nor 'sessionFs' was set. Empty mode requires \" +\n                        \"an explicit per-session persistence location; pick one.\"\n                );\n            }\n        }\n    }\n\n    private connectionExtraArgs: string[] = [];\n\n    /**\n     * Parse CLI URL into host and port\n     * Supports formats: \"host:port\", \"[ipv6]:port\", \"http://host:port\", \"https://host:port\", or just \"port\"\n     */\n    private parseCliUrl(url: string): { host: string; port: number } {\n        // Remove protocol if present\n        const cleanUrl = url.replace(/^https?:\\/\\//, \"\");\n","sourceCodeStart":722,"sourceCodeEnd":758,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/nodejs/src/client.ts#L722-L758","documentation":"Error \"CopilotClient was created with mode: 'empty' but neither 'baseDirectory' nor 'sessionFs' was set. Empty mode requires an explicit per-session persistence location; pick one.\" thrown in github/copilot-sdk.","triggerScenarios":"Thrown at nodejs/src/client.ts:740 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set baseDirectory to a dedicated empty directory per tenant/session in the CopilotClient options","Alternatively provide a sessionFs configuration with a custom SessionFsProvider for per-session persistence","Do not rely on the default ~/.copilot fallback in empty mode; it is intentionally rejected"],"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"}