{"record":{"id":"0d032c2b2d77e63a","repo":"github/copilot-sdk","slug":"err-error","errorCode":null,"errorMessage":"err.Error()","messagePattern":"err\\.Error\\(\\)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/client.go","lineNumber":336,"sourceCode":"\t\t\tclient.cliPath = cliPath\n\t\t}\n\t}\n\n\t// Resolve the effective connection token: explicit value if set; else if the SDK\n\t// spawns its own runtime in TCP mode, generate a UUID; otherwise empty. The\n\t// in-process transport uses no socket, so it needs no connection token.\n\tif client.tcpConnectionToken != \"\" {\n\t\tclient.effectiveConnectionToken = client.tcpConnectionToken\n\t} else if !client.useStdio && !client.isExternalServer && !client.useInProcess {\n\t\tclient.effectiveConnectionToken = uuid.NewString()\n\t}\n\n\tif opts.OnListModels != nil {\n\t\tclient.onListModels = opts.OnListModels\n\t}\n\tif opts.SessionFS != nil {\n\t\tif err := validateSessionFSConfig(opts.SessionFS); err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t}\n\n\tclient.options = opts\n\tvalidateNewClientForMode(&client.options)\n\treturn client\n}\n\nfunc resolveRuntimeExecutable(explicitPath, bundledRuntimePath string) (string, error) {\n\tif explicitPath != \"\" {\n\t\treturn explicitPath, nil\n\t}\n\tif bundledRuntimePath == \"\" {\n\t\treturn \"\", errors.New(\n\t\t\t\"managed Copilot runtime unavailable: the embedded bundle does not contain copilot-runtime and adjacent runtime.node; regenerate the bundle, provide an explicit path, or set COPILOT_CLI_PATH\",\n\t\t)\n\t}\n\treturn bundledRuntimePath, nil","sourceCodeStart":318,"sourceCodeEnd":354,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/client.go#L318-L354","documentation":"NewClient panics when ClientOptions.SessionFS fails validateSessionFSConfig; the validation error's message (err.Error()) is passed to panic. The SessionFS option configures a session filesystem backend, and an invalid combination/settings (per validateSessionFSConfig) cannot be used to build a client.","triggerScenarios":"Calling NewClient with a non-nil Options.SessionFS whose configuration violates validateSessionFSConfig's rules (e.g. missing required fields or incompatible settings). The error text comes from that validator, surfaced at go/client.go:336.","commonSituations":"Configuring a custom session filesystem backend with partially filled options; changing SessionFS settings after an SDK update that tightened validation.","solutions":["Read the panic message — it is the validator's error — and correct the offending SessionFS field.","Call the same validation logic (or replicate its checks) before constructing the client.","If the backend isn't needed, leave SessionFS nil to use the default."],"exampleFix":"// before\nclient := clientpkg.NewClient(&clientpkg.Options{SessionFS: &clientpkg.SessionFSConfig{}} // invalid: incomplete\n)\n// after\nif err := validateSessionFSConfig(cfg); err != nil {\n    return fmt.Errorf(\"invalid SessionFS config: %w\", err)\n}\nclient := clientpkg.NewClient(&clientpkg.Options{SessionFS: cfg})","handlingStrategy":"validation","validationCode":"if opts.SessionFS != nil {\n    if err := validateSessionFSConfig(opts.SessionFS); err != nil {\n        return fmt.Errorf(\"invalid SessionFS: %w\", err)\n    }\n}","typeGuard":null,"tryCatchPattern":"defer func() {\n    if r := recover(); r != nil {\n        err = fmt.Errorf(\"client construction failed: %v\", r)\n    }\n}()\nclient := clientpkg.NewClient(opts)","preventionTips":["Run the same validation as the SDK before constructing the client.","Keep SessionFS config in typed structs with defaults so required fields are never empty.","Re-validate SessionFS settings after SDK upgrades."],"tags":["go","panic","validation","sessionfs","configuration"],"backgroundTag":"invalid-config-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"}