{"record":{"id":"49baef021bdac5b6","repo":"github/copilot-sdk","slug":"createsessionfsprovider-is-required-in-the-session","errorCode":null,"errorMessage":"CreateSessionFsProvider is required in the session config when CopilotClientOptions.SessionFs is configured.","messagePattern":"CreateSessionFsProvider is required in the session config when CopilotClientOptions\\.SessionFs is configured\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Client.cs","lineNumber":2154,"sourceCode":"    {\n        if (_clientGlobalApis?.LlmInference is null)\n        {\n            return;\n        }\n\n        await Rpc.LlmInference.SetProviderAsync(cancellationToken);\n    }\n\n    private void ConfigureSessionFsHandlers(CopilotSession session, Func<CopilotSession, SessionFsProvider>? createSessionFsHandler)\n    {\n        if (_options.SessionFs is null)\n        {\n            return;\n        }\n\n        if (createSessionFsHandler is null)\n        {\n            throw new InvalidOperationException(\n                \"CreateSessionFsProvider is required in the session config when CopilotClientOptions.SessionFs is configured.\");\n        }\n\n        var provider = createSessionFsHandler(session)\n            ?? throw new InvalidOperationException(\"CreateSessionFsProvider returned null.\");\n\n        if (_options.SessionFs.Capabilities?.Sqlite == true && provider is not ISessionFsSqliteProvider)\n        {\n            throw new InvalidOperationException(\n                \"SessionFsConfig declares capabilities.sqlite but the provider does not implement ISessionFsSqliteProvider.\");\n        }\n\n        session.ClientSessionApis.SessionFs = provider;\n    }\n\n    private async Task VerifyProtocolVersionAsync(Connection connection, CancellationToken cancellationToken)\n    {\n        var handshakeTimestamp = Stopwatch.GetTimestamp();","sourceCodeStart":2136,"sourceCodeEnd":2172,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/dotnet/src/Client.cs#L2136-L2172","documentation":"When CopilotClientOptions.SessionFs is configured, the client requires a `CreateSessionFsProvider` handler in the session configuration to construct the filesystem provider instance for each session. The handler passed down from the session config was null, so the client cannot build the SessionFs and throws.","triggerScenarios":"CopilotClientOptions.SessionFs is set (with a SessionFsConfig) but the session-level createSessionFsHandler delegate is null when InitializeSessionFs runs (Client.cs:2154).","commonSituations":"Configuring SessionFs options globally but forgetting to supply the CreateSessionFsProvider factory in the per-session config; wiring only part of the session setup after upgrading the SDK; building the session config from a partial/deserialized object where the handler could not be carried over.","solutions":["Set CreateSessionFsProvider in the session configuration to a factory returning your ISessionFsProvider implementation.","If you do not intend to use a custom session filesystem, remove CopilotClientOptions.SessionFs so this path is skipped.","Check the code path that builds the session config to ensure the handler is assigned before the session starts."],"exampleFix":"// before\noptions.SessionFs = new SessionFsConfig { Capabilities = new() { Sqlite = true } };\n\n// after\noptions.SessionFs = new SessionFsConfig { Capabilities = new() { Sqlite = true } };\nsessionConfig.CreateSessionFsProvider = _ => new MySessionFsProvider();","handlingStrategy":"validation","validationCode":"if (options.SessionFs is not null && sessionConfig.CreateSessionFsProvider is null)\n    throw new InvalidOperationException(\"SessionFs configured but CreateSessionFsProvider missing\");","typeGuard":null,"tryCatchPattern":"try\n{\n    session = await client.CreateSessionAsync(sessionConfig);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"CreateSessionFsProvider is required\"))\n{\n    logger.LogError(ex, \"Session config missing CreateSessionFsProvider while SessionFs options are set\");\n}","preventionTips":["Set SessionFs options and the CreateSessionFsProvider handler together in one factory method.","Add a startup assertion that both are configured or both are absent.","Review SDK upgrade notes for new required session-config fields."],"tags":["configuration","session-fs","missing-handler"],"backgroundTag":"missing-required-config-field","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}