{"record":{"id":"306e2b08d278a229","repo":"github/copilot-sdk","slug":"invalid-s-value-q-expected-inprocess-stdio","errorCode":null,"errorMessage":"invalid %s value %q: expected \"inprocess\", \"stdio\", or unset","messagePattern":"invalid (.+?) value %q: expected \"inprocess\", \"stdio\", or unset","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/client.go","lineNumber":370,"sourceCode":"\t\t)\n\t}\n\treturn bundledRuntimePath, nil\n}\n\nconst defaultConnectionEnvVar = \"COPILOT_SDK_DEFAULT_CONNECTION\"\n\n// resolveDefaultConnection selects the transport when no explicit connection\n// was supplied. The override is primarily used by hosts and the E2E transport\n// matrix; explicit connection options always take precedence.\nfunc resolveDefaultConnection(env []string) RuntimeConnection {\n\tvalue := getEnvValue(env, defaultConnectionEnvVar)\n\tswitch {\n\tcase value == \"\", strings.EqualFold(value, \"stdio\"):\n\t\treturn StdioConnection{}\n\tcase strings.EqualFold(value, \"inprocess\"):\n\t\treturn InProcessConnection{}\n\tdefault:\n\t\tpanic(fmt.Sprintf(\n\t\t\t\"invalid %s value %q: expected \\\"inprocess\\\", \\\"stdio\\\", or unset\",\n\t\t\tdefaultConnectionEnvVar,\n\t\t\tvalue,\n\t\t))\n\t}\n}\n\n// getEnvValue looks up a key in an environment slice ([]string of \"KEY=VALUE\").\n// Returns the value if found, or empty string otherwise.\nfunc getEnvValue(env []string, key string) string {\n\tprefix := key + \"=\"\n\tfor i := len(env) - 1; i >= 0; i-- {\n\t\tif strings.HasPrefix(env[i], prefix) {\n\t\t\treturn env[i][len(prefix):]\n\t\t}\n\t}\n\treturn \"\"\n}","sourceCodeStart":352,"sourceCodeEnd":388,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/client.go#L352-L388","documentation":"resolveDefaultConnection panics when the default-connection environment variable (defaultConnectionEnvVar, e.g. controlling COPILOT_CLI_CONNECTION) holds a value other than \"inprocess\", \"stdio\", or empty. The env var selects the transport used when none is given in code, and only those two transports exist.","triggerScenarios":"Setting the env var to a typo or unsupported transport name (e.g. \"in-process\", \"tcp\", \"child\") and then calling NewClient without an explicit Connection. Panic raised at go/client.go:370 with the offending value.","commonSituations":"CI/export scripts exporting COPILOT_CLI_CONNECTION=in-process (hyphen) instead of inprocess; documentation drift after the env var was introduced; shell typos.","solutions":["Set the env var to exactly \"stdio\" or \"inprocess\" (case-insensitive), or unset it entirely.","Pass an explicit Connection in code (StdioConnection{} or InProcessConnection{}) so the env var is ignored.","Grep your deploy scripts/CI for the env var name and fix stale values after SDK upgrades."],"exampleFix":"// before (shell)\nexport COPILOT_CLI_CONNECTION=in-process\n// after (shell)\nexport COPILOT_CLI_CONNECTION=inprocess\n// or in Go, override explicitly:\nclient := clientpkg.NewClient(&clientpkg.Options{Connection: clientpkg.InProcessConnection{}})","handlingStrategy":"validation","validationCode":"switch strings.ToLower(os.Getenv(\"COPILOT_CLI_CONNECTION\")) {\ncase \"\", \"stdio\", \"inprocess\":\n    // ok\ndefault:\n    return fmt.Errorf(\"invalid COPILOT_CLI_CONNECTION value %q\", os.Getenv(\"COPILOT_CLI_CONNECTION\"))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate the env var at process startup, before any client construction.","Prefer setting Connection explicitly in code over relying on the env var.","Use an allowlist check (case-insensitive) in shell scripts and CI."],"tags":["go","panic","env-var","transport","configuration"],"backgroundTag":"invalid-env-var-value","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"}