{"record":{"id":"54e7d9fc154b3fad","repo":"chenhg5/cc-connect","slug":"copilotsession-start-w","errorCode":null,"errorMessage":"copilotSession: start: %w","messagePattern":"copilotSession: start: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"agent/copilot/session.go","lineNumber":123,"sourceCode":"\n\tstdin, err := child.StdinPipe()\n\tif err != nil {\n\t\tcancel()\n\t\treturn nil, fmt.Errorf(\"copilotSession: stdin pipe: %w\", err)\n\t}\n\n\tstdout, err := child.StdoutPipe()\n\tif err != nil {\n\t\tcancel()\n\t\treturn nil, fmt.Errorf(\"copilotSession: stdout pipe: %w\", err)\n\t}\n\n\tvar stderrBuf bytes.Buffer\n\tchild.Stderr = &stderrBuf\n\n\tif err := child.Start(); err != nil {\n\t\tcancel()\n\t\treturn nil, fmt.Errorf(\"copilotSession: start: %w\", err)\n\t}\n\n\tcs := &copilotSession{\n\t\tcmd:                child,\n\t\trpc:                newRPCClient(stdin),\n\t\treader:             newLSPReader(stdout),\n\t\tevents:             make(chan core.Event, 64),\n\t\tmode:               mode,\n\t\tmodel:              model,\n\t\tprovider:           provider,\n\t\tworkDir:            workDir,\n\t\tctx:                sessionCtx,\n\t\tcancel:             cancel,\n\t\tdone:               make(chan struct{}),\n\t\tpendingPermissions: make(map[string]json.RawMessage),\n\t\teventPermissions:   make(map[string]struct{}),\n\t}\n\tcs.alive.Store(true)","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/copilot/session.go#L105-L141","documentation":"After wiring pipes, newCopilotSession calls child.Start() to launch the copilot CLI process. If the executable cannot be launched the context is cancelled and the error is wrapped as \"copilotSession: start: %w\" — the underlying os/exec error (ExecNotFoundError, permission denied, etc.) is preserved inside.","triggerScenarios":"StartSession → newCopilotSession where exec fails: the copilot CLI binary is not on PATH, the path in config is wrong, the binary lacks execute permission, or the working directory/env is invalid.","commonSituations":"Copilot CLI not installed (missing `copilot` on PATH); config points to an outdated or renamed binary; a version upgrade changed the binary name or location; running under a service account without execute rights on the binary.","solutions":["Verify the binary exists and runs: run the exact path/args from your config manually","Check the `path`/binary setting in config.toml — fix or reinstall the copilot CLI","Ensure execute permission on the binary and that the daemon's PATH includes its directory (GUI services often have a minimal PATH)","Run `cc-connect doctor` (or your platform's diagnostics) to see the resolved CLI path"],"exampleFix":"// before (config.toml)\n[agents.copilot]\npath = \"/usr/local/bin/copilotcli\"   # stale name\n// after\n[agents.copilot]\npath = \"/usr/local/bin/copilot\"       # actual installed binary, verified with `which copilot`","handlingStrategy":"try-catch","validationCode":"// before starting a session, verify the binary\np := cfg.CopilotPath // e.g. from config\nif _, err := os.Stat(p); err != nil {\n    return fmt.Errorf(\"copilot binary not found at %s\", p)\n}\nif info, err := os.Stat(p); err == nil && info.Mode()&0o111 == 0 {\n    return fmt.Errorf(\"copilot binary %s is not executable\", p)\n}","typeGuard":null,"tryCatchPattern":"sess, err := StartSession(ctx, cfg, resumeID)\nif err != nil {\n    if strings.Contains(err.Error(), \"start:\") {\n        var execErr *exec.Error\n        if errors.As(err, &execErr) {\n            slog.Error(\"copilot CLI not launchable\", \"name\", execErr.Name, \"err\", execErr.Err)\n        }\n    }\n    return err\n}","preventionTips":["Verify the binary path in config.toml with `which`/`command -v` after upgrades","Run `cc-connect doctor` to validate the CLI install","Set an explicit absolute path in config instead of relying on PATH","Re-check execute permissions when provisioning service accounts"],"tags":["exec","process","binary-not-found","startup"],"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-14T05:17:10.506Z"}