{"record":{"id":"62fd9d661f2203c3","repo":"sipeed/picoclaw","slug":"local-command-q-does-not-exist","errorCode":null,"errorMessage":"local command %q does not exist","messagePattern":"local command %q does not exist","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/picoclaw/internal/mcp/helpers.go","lineNumber":317,"sourceCode":"\tif path == \"~\" {\n\t\treturn home\n\t}\n\tif strings.HasPrefix(path, \"~/\") || strings.HasPrefix(path, \"~\\\\\") {\n\t\treturn filepath.Join(home, path[2:])\n\t}\n\treturn path\n}\n\nfunc validateLocalCommandPath(command string) error {\n\tif !isLocalCommandPath(command) {\n\t\treturn nil\n\t}\n\n\tpath := expandHomePath(command)\n\tinfo, err := os.Stat(path)\n\tif err != nil {\n\t\tif errors.Is(err, os.ErrNotExist) {\n\t\t\treturn fmt.Errorf(\"local command %q does not exist\", command)\n\t\t}\n\t\treturn fmt.Errorf(\"failed to stat local command %q: %w\", command, err)\n\t}\n\tif info.IsDir() {\n\t\treturn fmt.Errorf(\"local command %q is a directory\", command)\n\t}\n\tif runtime.GOOS != \"windows\" && info.Mode()&0o111 == 0 {\n\t\treturn fmt.Errorf(\"local command %q is not executable\", command)\n\t}\n\treturn nil\n}\n\nfunc defaultServerProbe(\n\tctx context.Context,\n\tname string,\n\tserver config.MCPServerConfig,\n\tworkspacePath string,\n) (probeResult, error) {","sourceCodeStart":299,"sourceCodeEnd":335,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/cmd/picoclaw/internal/mcp/helpers.go#L299-L335","documentation":"For stdio servers whose target is path-like (absolute, ./, ../, contains a path separator, or starts with ~ — isLocalCommandPath, helpers.go:275-289), validateLocalCommandPath stats the file and ErrNotExist produces this error (helpers.go:314-318). Bare command names like npx or uvx are deliberately not checked; only explicit paths are verified before saving.","triggerScenarios":"`picoclaw mcp add s ./build/server` when the binary was never built; `picoclaw mcp add s -- ~/tools/mcp-serve` with a typo; ~ expansion resolving against a different home directory.","commonSituations":"Build output path changed after a refactor; running on a second machine where the tool lives elsewhere; wrong case in the filename on case-sensitive filesystems.","solutions":["Verify the file exists: ls -l <path> from the same directory you run picoclaw in","Use an absolute path or ~/ prefix so resolution does not depend on cwd","Build or install the binary first, then retry the add"],"exampleFix":"# before\npicoclaw mcp add s ./bin/server\n# after\nmake build && picoclaw mcp add s \"$PWD/bin/server\"","handlingStrategy":"validation","validationCode":"cmd_path=${cmd#-- }   # strip leading -- if present\nif [[ $cmd_path == */* || $cmd_path == ~* || $cmd_path == .* ]]; then\n  [ -e \"$cmd_path\" ] || { echo \"command path '$cmd_path' does not exist\" >&2; exit 1; }\nfi\npicoclaw mcp add \"$name\" $cmd_path","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Reference stdio commands by absolute path or ~-relative path so they resolve regardless of cwd","Build/install the server binary before registering it","Bare names (npx, uvx) skip this check — use them when the tool is on PATH"],"tags":["cli","mcp","stdio","filesystem","validation"],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}