{"record":{"id":"896a89e6c7c9711e","repo":"plandex-ai/plandex","slug":"error-executing-command-v","errorCode":null,"errorMessage":"error executing command: %v","messagePattern":"error executing command: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/cmd/repl.go","lineNumber":1085,"sourceCode":"\tfilePath := args[0]\n\n\t// Check if file exists\n\tif _, err := os.Stat(filePath); os.IsNotExist(err) {\n\t\treturn fmt.Errorf(\"file does not exist: %s\", filePath)\n\t}\n\n\t// Build command based on current mode\n\tvar cmdArgs []string\n\tif lib.CurrentReplState.Mode == lib.ReplModeTell {\n\t\tcmdArgs = []string{\"tell\", \"-f\", filePath}\n\t} else {\n\t\tcmdArgs = []string{\"chat\", \"-f\", filePath}\n\t}\n\n\t// Execute the command\n\t_, err := lib.ExecPlandexCommand(cmdArgs)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error executing command: %v\", err)\n\t}\n\n\treturn nil\n}\n\nfunc getPromptOpt(cmd string) string {\n\tasPrompt := cmd\n\tif len(asPrompt) > 20 {\n\t\tasPrompt = asPrompt[:20] + \"...\"\n\t}\n\treturn fmt.Sprintf(\"Send '%s' as a prompt to the AI model\", asPrompt)\n}\n\ntype suggestCmdsResult struct {\n\tshouldReturn bool\n\tmatchedCmd   string\n}\n","sourceCodeStart":1067,"sourceCodeEnd":1103,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/cmd/repl.go#L1067-L1103","documentation":"Thrown by handleRunCommand when lib.ExecPlandexCommand fails to execute the constructed 'tell' or 'chat' command with the -f file argument. This wraps any error from launching/running the subcommand, including non-zero exits or exec failures.","triggerScenarios":"ExecPlandexCommand(cmdArgs) returns an error — the executable is not on PATH, the subcommand itself fails (e.g. auth, network), or args are malformed.","commonSituations":"Running the REPL from a partially installed binary, underlying 'tell'/'chat' failing due to auth or network issues, permission denied on the executable.","solutions":["Read the wrapped error (%v) for the underlying cause","Verify the plandex binary is installed and on PATH","Re-authenticate if the subcommand failed on auth","Run the equivalent command directly (plandex tell -f <file>) to isolate the failure"],"exampleFix":"// before\n_, err := lib.ExecPlandexCommand(cmdArgs)\nif err != nil {\n    return fmt.Errorf(\"error executing command: %v\", err)\n}\n// after\n_, err := lib.ExecPlandexCommand(cmdArgs)\nif err != nil {\n    return fmt.Errorf(\"error executing command %v: %w\", cmdArgs, err)\n}","handlingStrategy":"try-catch","validationCode":"if !fileExists(filePath) { return fmt.Errorf(\"file does not exist\") }\nif _, err := exec.LookPath(os.Args[0]); err != nil {\n    return fmt.Errorf(\"plandex executable not found on PATH\")\n}","typeGuard":null,"tryCatchPattern":"_, err := lib.ExecPlandexCommand(cmdArgs)\nif err != nil {\n    var exitErr *exec.ExitError\n    if errors.As(err, &exitErr) {\n        return fmt.Errorf(\"subcommand failed with exit %d\", exitErr.ExitCode())\n    }\n    return err\n}","preventionTips":["Ensure the binary is installed and on PATH","Authenticate before invoking tell/chat subcommands","Test the equivalent direct command to isolate failures","Wrap exec errors with %w to preserve the cause chain"],"tags":["cli","repl","exec"],"backgroundTag":"command-execution-failed","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}