{"record":{"id":"480b6eb99b336e11","repo":"chenhg5/cc-connect","slug":"acp-command-q-not-found-in-path-w","errorCode":null,"errorMessage":"acp: command %q not found in PATH: %w","messagePattern":"acp: command %q not found in PATH: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/acp/agent.go","lineNumber":81,"sourceCode":"\n// Ensure *Agent satisfies sessionCallbacks at compile time.\nvar _ sessionCallbacks = (*Agent)(nil)\n\n// New builds an acp agent from project options.\n// Required: options[\"command\"] — executable name or path for the ACP agent.\n// Optional: options[\"args\"], options[\"env\"], options[\"auth_method\"],\n// options[\"display_name\"], options[\"mode\"].\nfunc New(opts map[string]any) (core.Agent, error) {\n\tworkDir, _ := opts[\"work_dir\"].(string)\n\tif workDir == \"\" {\n\t\tworkDir = \".\"\n\t}\n\tcmdStr, cliExtraArgs := core.ParseCmdOpts(opts, \"\")\n\tif cmdStr == \"\" {\n\t\treturn nil, fmt.Errorf(\"acp: agent option \\\"cmd\\\" or \\\"command\\\" is required (path or name of the ACP agent binary)\")\n\t}\n\tif _, err := exec.LookPath(cmdStr); err != nil {\n\t\treturn nil, fmt.Errorf(\"acp: command %q not found in PATH: %w\", cmdStr, err)\n\t}\n\n\targs := parseStringSlice(opts[\"args\"])\n\tstaticEnv := envMapFromOpts(opts)\n\textra := envPairsFromOpts(opts)\n\tauthMethod, _ := opts[\"auth_method\"].(string)\n\tauthMethod = strings.TrimSpace(authMethod)\n\tdisplayName, _ := opts[\"display_name\"].(string)\n\tdisplayName = strings.TrimSpace(displayName)\n\tif displayName == \"\" {\n\t\tdisplayName = \"ACP\"\n\t}\n\tmode, _ := opts[\"mode\"].(string)\n\tmode = strings.TrimSpace(mode)\n\n\treturn &Agent{\n\t\tworkDir:     workDir,\n\t\tcmd:          cmdStr,","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/acp/agent.go#L63-L99","documentation":"After reading the 'cmd'/'command' option, the ACP agent constructor runs exec.LookPath on it. If the binary cannot be found in PATH (or the given path doesn't exist / isn't executable), New returns this wrapped error including the LookPath detail. The agent process was never started; this is a pre-flight check.","triggerScenarios":"core.CreateAgent(\"acp\", opts) where opts[\"cmd\"] names a binary not present in any PATH directory, references an absolute path that doesn't exist or lacks the executable bit, or relies on an interpreter/alias that isn't on the daemon's PATH.","commonSituations":"Running cc-connect as a systemd service whose PATH is minimal and lacks nvm/homebrew locations (~/.local/bin, /usr/local/bin); typos in the binary name; installed the agent under a user account but the daemon runs as another user; binary not yet built.","solutions":["Use an absolute path to the binary in cmd, e.g. cmd = \"/home/user/.local/bin/my-acp-agent\".","Install the binary or `go install`/`npm i -g` it, and verify with `which <name>`.","Extend the service's PATH (systemd: Environment=PATH=...) or set the env option so LookPath succeeds.","Check the executable bit (`chmod +x`) if the file exists at the given path."],"exampleFix":"// before (config.toml)\n[agents.acp]\ncmd = \"gemini-acp\"  # not on systemd's PATH\n// after\n[agents.acp]\ncmd = \"/home/dev/.npm-global/bin/gemini-acp\"","handlingStrategy":"validation","validationCode":"func checkACPCmd(cmd string) error {\n    p, err := exec.LookPath(cmd)\n    if err != nil {\n        return fmt.Errorf(\"acp binary %q not found in PATH (set an absolute path for daemons): %w\", cmd, err)\n    }\n    fmt.Println(\"acp binary resolved to\", p)\n    return nil\n}","typeGuard":null,"tryCatchPattern":"agent, err := core.CreateAgent(\"acp\", opts)\nvar le *exec.Error\nif errors.As(err, &le) || strings.Contains(err.Error(), \"not found in PATH\") {\n    return fmt.Errorf(\"fix [agents.acp].cmd: use an absolute path usable by the service user: %w\", err)\n}","preventionTips":["Prefer absolute paths for cmd in daemon/service configs","Verify with `which <binary>` as the same user the daemon runs as","Set systemd Environment=PATH=... to include user install dirs (~/.local/bin, nvm, npm-global)","chmod +x the binary after install"],"tags":["acp","command-not-found","path","configuration","agent"],"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"}