{"record":{"id":"6207cff6b2d53d86","repo":"github/copilot-sdk","slug":"createsessionfsprovider-is-required-in-session-con-6207cf","errorCode":null,"errorMessage":"CreateSessionFSProvider is required in session config when SessionFS is enabled in client options","messagePattern":"CreateSessionFSProvider is required in session config when SessionFS is enabled in client options","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/client.go","lineNumber":1080,"sourceCode":"\t\t}\n\t\tif config.OnAutoModeSwitchRequest != nil {\n\t\t\ts.registerAutoModeSwitchHandler(config.OnAutoModeSwitchRequest)\n\t\t}\n\t\tif config.CanvasHandler != nil {\n\t\t\ts.registerCanvasHandler(config.CanvasHandler)\n\t\t}\n\t\tif bearerTokenProviders := collectBearerTokenProviders(config.Provider, config.Providers); bearerTokenProviders != nil {\n\t\t\ts.registerBearerTokenProviders(bearerTokenProviders)\n\t\t}\n\n\t\tc.sessionsMux.Lock()\n\t\tc.sessions[sessionID] = s\n\t\tc.sessionsMux.Unlock()\n\n\t\tif c.options.SessionFS != nil {\n\t\t\tif config.CreateSessionFSProvider == nil {\n\t\t\t\tunregisterSession(sessionID, s)\n\t\t\t\treturn nil, fmt.Errorf(\"CreateSessionFSProvider is required in session config when SessionFS is enabled in client options\")\n\t\t\t}\n\t\t\tprovider := config.CreateSessionFSProvider(s)\n\t\t\tif c.options.SessionFS.Capabilities != nil && c.options.SessionFS.Capabilities.Sqlite {\n\t\t\t\tif _, ok := provider.(SessionFSSqliteProvider); !ok {\n\t\t\t\t\tunregisterSession(sessionID, s)\n\t\t\t\t\treturn nil, fmt.Errorf(\"SessionFS capabilities declare SQLite support but the provider does not implement SessionFSSqliteProvider\")\n\t\t\t\t}\n\t\t\t}\n\t\t\ts.clientSessionAPIs.SessionFS = newSessionFSAdapter(provider)\n\t\t}\n\t\treturn s, nil\n\t}\n\n\tvar session *Session\n\tvar registeredSessionID string\n\n\t// Pre-register non-cloud sessions BEFORE issuing the RPC so any\n\t// session-scoped requests the CLI emits during session.create processing","sourceCodeStart":1062,"sourceCodeEnd":1098,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/client.go#L1062-L1098","documentation":"When client options enable SessionFS, each session config must supply a CreateSessionFSProvider factory that builds the filesystem provider for that session. CreateSession enforces this after registering the session and unregisters it if the provider factory is missing.","triggerScenarios":"Client created with options.SessionFS != nil, but the SessionConfig passed to CreateSession has a nil CreateSessionFSProvider.","commonSituations":"Enabling SessionFS globally in client options but forgetting per-session provider wiring; copying a minimal SessionConfig example that omits the provider.","solutions":["Provide config.CreateSessionFSProvider returning a valid SessionFS provider.","If SessionFS is not needed, remove SessionFS from client options instead.","Implement the provider interface required by your SessionFS capabilities."],"exampleFix":"// before\ncfg := &SessionConfig{} // SessionFS enabled in client options\n// after\ncfg := &SessionConfig{\n    CreateSessionFSProvider: func(s *Session) SessionFSProvider { return myProvider },\n}","handlingStrategy":"validation","validationCode":"if clientUsesSessionFS && cfg.CreateSessionFSProvider == nil { return errors.New(\"CreateSessionFSProvider required\") }","typeGuard":null,"tryCatchPattern":"if _, err := client.CreateSession(ctx, cfg); err != nil && strings.Contains(err.Error(), \"CreateSessionFSProvider is required\") { /* add provider */ }","preventionTips":["Wire the FS provider whenever SessionFS is enabled","Share a config template with the provider included","Document the SessionFS prerequisite"],"tags":["go","config","filesystem"],"backgroundTag":"missing-required-argument","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"}