{"record":{"id":"1ec3cdd04edff3c2","repo":"chenhg5/cc-connect","slug":"copilot-probe-start-w","errorCode":null,"errorMessage":"copilot probe: start: %w","messagePattern":"copilot probe: start: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/copilot/copilot.go","lineNumber":229,"sourceCode":"\tcmd := exec.CommandContext(probeCtx, snapshot.cmd, \"--headless\", \"--stdio\", \"--no-auto-update\")\n\tcmd.Dir = snapshot.workDir\n\tcmd.Env = snapshot.env\n\n\tstdin, err := cmd.StdinPipe()\n\tif err != nil {\n\t\tcancel()\n\t\treturn nil, fmt.Errorf(\"copilot probe: stdin pipe: %w\", err)\n\t}\n\tstdout, err := cmd.StdoutPipe()\n\tif err != nil {\n\t\tcancel()\n\t\treturn nil, fmt.Errorf(\"copilot probe: stdout pipe: %w\", err)\n\t}\n\tcmd.Stderr = io.Discard\n\n\tif err := cmd.Start(); err != nil {\n\t\tcancel()\n\t\treturn nil, fmt.Errorf(\"copilot probe: start: %w\", err)\n\t}\n\n\trpc := newRPCClient(stdin)\n\treader := newLSPReader(stdout)\n\tdone := make(chan struct{})\n\n\tgo func() {\n\t\tdefer func() {\n\t\t\t_ = stdin.Close()\n\t\t\t_ = cmd.Wait()\n\t\t\tclose(done)\n\t\t}()\n\t\tfor {\n\t\t\tbody, err := reader.readMessage()\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tvar resp jsonRPCResponse","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/copilot/copilot.go#L211-L247","documentation":"This error wraps cmd.Start() failing when launching the copilot CLI binary for a probe session used by ListSessions/DeleteSession. Start fails when the binary cannot be found/executed, lacks execute permission, or the working directory/cwd is invalid. Stderr is discarded (io.Discard) so the underlying reason is hidden, making this error notoriously opaque.","triggerScenarios":"ListSessions or DeleteSession invoking newProbeSession when the copilot binary path is wrong, the binary is not installed, is not executable, or exec cannot fork (resource limits).","commonSituations":"Copilot CLI not installed or not on PATH after a machine rebuild; binary updated/renamed by a copilot version change; config points at a wrong cli_path; running in a slim container without the CLI.","solutions":["Verify the copilot CLI is installed and executable: run `which copilot` / the configured path manually","Check/fix the copilot binary path configured in config.toml (agent options)","Ensure the binary has the execute bit: `chmod +x $(which copilot)`","Reinstall or upgrade the GitHub Copilot CLI to restore the expected binary","Temporarily remove `cmd.Stderr = io.Discard` in newProbeSession while debugging to see the OS error detail"],"exampleFix":"// before (debugging)\ncmd.Stderr = io.Discard\nif err := cmd.Start(); err != nil {\n    cancel()\n    return nil, fmt.Errorf(\"copilot probe: start: %w\", err)\n}\n// after (debug)\nvar stderr bytes.Buffer\ncmd.Stderr = &stderr\nif err := cmd.Start(); err != nil {\n    cancel()\n    return nil, fmt.Errorf(\"copilot probe: start: %w: %s\", err, stderr.String())\n}","handlingStrategy":"validation","validationCode":"// verify the CLI is runnable before probe-dependent calls\nbin := \"copilot\" // or configured path\nif path, err := exec.LookPath(bin); err != nil {\n    return fmt.Errorf(\"copilot CLI not found: %w\", err)\n} else if info, err := os.Stat(path); err != nil || info.Mode()&0o111 == 0 {\n    return fmt.Errorf(\"copilot CLI %s is not executable\", path)\n}","typeGuard":null,"tryCatchPattern":"if _, err := a.ListSessions(ctx); err != nil && strings.Contains(err.Error(), \"probe: start:\") {\n    return fmt.Errorf(\"copilot CLI missing or not executable — run `cc-connect doctor`: %w\", err)\n}","preventionTips":["Run `cc-connect doctor` after installing/upgrading agents","Pin the copilot CLI path in config.toml instead of relying on PATH","Add a startup check that executes `<cli> --version` before serving"],"tags":["go","process","exec","copilot","command-not-found"],"backgroundTag":"command-not-found","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}