{"record":{"id":"8c926d005c6779c0","repo":"github/copilot-sdk","slug":"sessionfs-conventions-must-be-either-posix-or-w","errorCode":null,"errorMessage":"SessionFS.Conventions must be either 'posix' or 'windows'","messagePattern":"SessionFS\\.Conventions must be either 'posix' or 'windows'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/client.go","lineNumber":93,"sourceCode":"\t}\n\tif len(callbacks) == 0 {\n\t\treturn nil\n\t}\n\treturn callbacks\n}\n\nfunc validateSessionFSConfig(config *SessionFSConfig) error {\n\tif config == nil {\n\t\treturn nil\n\t}\n\tif config.InitialWorkingDirectory == \"\" {\n\t\treturn errors.New(\"SessionFS.InitialWorkingDirectory is required\")\n\t}\n\tif config.SessionStatePath == \"\" {\n\t\treturn errors.New(\"SessionFS.SessionStatePath is required\")\n\t}\n\tif config.Conventions != rpc.SessionFSSetProviderConventionsPosix && config.Conventions != rpc.SessionFSSetProviderConventionsWindows {\n\t\treturn errors.New(\"SessionFS.Conventions must be either 'posix' or 'windows'\")\n\t}\n\treturn nil\n}\n\n// validateEnvironmentOptions enforces the transport-specific rules for\n// per-client environment, working directory, and telemetry. It panics (fails\n// loud) on a misconfiguration, matching the other SDKs.\n//\n// The in-process transport loads the native runtime into this process, whose\n// single environment block and process-global working directory cannot carry\n// per-client values, and whose telemetry lowers to shared process-global env\n// vars — so options that depend on them are rejected there. Child-process\n// transports each own their OS process, so per-connection env is allowed, but\n// setting it in both the client-level option and the connection is rejected.\nfunc validateEnvironmentOptions(connection RuntimeConnection, opts *ClientOptions) {\n\tif _, ok := connection.(InProcessConnection); ok {\n\t\tif opts.Env != nil {\n\t\t\tpanic(\"Env is not supported with InProcessConnection: the in-process transport loads the native runtime into the shared host process, whose single environment block cannot carry per-client values. Set the variables on the host process environment instead.\")","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/client.go#L75-L111","documentation":"SessionFS.Conventions must be exactly rpc.SessionFSSetProviderConventionsPosix or ...Windows. The library needs to know the path-separator convention of the filesystem provider, and any other value (including the zero value) is rejected by validateSessionFSConfig.","triggerScenarios":"Calling NewClient with SessionFS.Conventions left as the zero value, a lowercase custom string, or a typo'd constant.","commonSituations":"Initializing the Config struct without setting Conventions; hand-writing the string \"posix\" instead of using the rpc constant; cross-platform code defaulting incorrectly on one OS.","solutions":["Set config.SessionFS.Conventions = rpc.SessionFSSetProviderConventionsPosix (or ...Windows) explicitly","Always use the rpc constants rather than raw string literals","Choose based on the host OS of the session, e.g. runtime.GOOS == \"windows\""],"exampleFix":"// before\ncfg.SessionFS.Conventions = \"posix\" // or zero value\n// after\nif runtime.GOOS == \"windows\" {\n    cfg.SessionFS.Conventions = rpc.SessionFSSetProviderConventionsWindows\n} else {\n    cfg.SessionFS.Conventions = rpc.SessionFSSetProviderConventionsPosix\n}","handlingStrategy":"validation","validationCode":"switch cfg.SessionFS.Conventions {\ncase rpc.SessionFSSetProviderConventionsPosix, rpc.SessionFSSetProviderConventionsWindows:\n    // ok\ndefault:\n    return fmt.Errorf(\"config error: SessionFS.Conventions must be posix or windows\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only ever assign the rpc.*Conventions constants, never raw strings","Set Conventions from runtime.GOOS in a shared constructor","Never construct SessionFS config with a zero-value struct literal"],"tags":["go","configuration","enum","validation"],"backgroundTag":"invalid-enum-value","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"}