{"record":{"id":"782c836748e40605","repo":"chenhg5/cc-connect","slug":"kimi-q-cli-not-found-in-path-install-with-pip","errorCode":null,"errorMessage":"kimi: %q CLI not found in PATH, install with: pip install kimi-cli","messagePattern":"kimi: %q CLI not found in PATH, install with: pip install kimi-cli","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/kimi/kimi.go","lineNumber":85,"sourceCode":"\tswitch v := opts[\"timeout_mins\"].(type) {\n\tcase int64:\n\t\ttimeoutMins = v\n\tcase int:\n\t\ttimeoutMins = int64(v)\n\tcase float64:\n\t\ttimeoutMins = int64(v)\n\tdefault:\n\t\tif v != nil {\n\t\t\tslog.Debug(\"kimi: timeout_mins has unexpected type\", \"type\", fmt.Sprintf(\"%T\", v))\n\t\t}\n\t}\n\tvar timeout time.Duration\n\tif timeoutMins > 0 {\n\t\ttimeout = time.Duration(timeoutMins) * time.Minute\n\t}\n\n\tif _, err := exec.LookPath(cmd); err != nil {\n\t\treturn nil, fmt.Errorf(\"kimi: %q CLI not found in PATH, install with: pip install kimi-cli\", cmd)\n\t}\n\n\t// Probe once so Send() can build args that match the installed CLI\n\t// surface (see #1456). The probe has its own timeout; failures fall\n\t// back to assuming the modern CLI (no --print).\n\tflagSupport := probeKimiFlags(context.Background(), cmd, 5*time.Second)\n\n\treturn &Agent{\n\t\tworkDir:      workDir,\n\t\tmodel:        model,\n\t\tmode:         mode,\n\t\tcmd:          cmd,\n\t\tcliExtraArgs: extraArgs,\n\t\tconfigEnv:    core.ParseConfigEnv(opts),\n\t\ttimeout:      timeout,\n\t\tactiveIdx:    -1,\n\t\tflagSupport:  flagSupport,\n\t}, nil","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/kimi/kimi.go#L67-L103","documentation":"Agent construction (New) fails when exec.LookPath cannot find the kimi CLI binary in PATH. The error names the binary and suggests installing it with `pip install kimi-cli`, since the agent shells out to the kimi CLI to run sessions.","triggerScenarios":"Creating a kimi agent via New(...) (directly or through core.CreateAgent(\"kimi\", opts)) when the configured/derived kimi command is not on PATH.","commonSituations":"kimi-cli never installed; installed in a Python venv that isn't activated in the daemon environment; systemd/launchd service has a minimal PATH missing ~/.local/bin or the venv bin dir; typo in config command name.","solutions":["Install the CLI: `pip install kimi-cli`","If already installed, verify with `which kimi` and add its directory to PATH for the daemon user","For systemd, set Environment=PATH=... (or ExecStart via absolute binary path) so the service sees the venv/~/.local/bin","Check the agent's `command` config option points at the correct binary name/path"],"exampleFix":"// config.toml — before\n[agents.kimi]\ncommand = \"kimi\" # not on daemon PATH\n// after (systemd unit)\nEnvironment=PATH=/home/app/.local/bin:/usr/local/bin:/usr/bin:/bin\n# or install: pip install kimi-cli","handlingStrategy":"validation","validationCode":"if _, err := exec.LookPath(\"kimi\"); err != nil {\n    return fmt.Errorf(\"kimi-cli not installed; run: pip install kimi-cli\")\n}","typeGuard":null,"tryCatchPattern":"agent, err := kimi.New(opts)\nif err != nil {\n    if strings.Contains(err.Error(), \"CLI not found in PATH\") {\n        return fmt.Errorf(\"install kimi-cli and ensure its bin dir is in the daemon PATH: %w\", err)\n    }\n    return err\n}","preventionTips":["Run `cc-connect doctor` (or a LookPath check) at startup before accepting messages","Install kimi-cli inside the same venv/user the daemon runs as","Set an explicit PATH in systemd/launchd unit files including ~/.local/bin","Document the pip install step in deployment runbooks"],"tags":["go","cli","path","kimi","installation"],"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"}