{"record":{"id":"58a2c1cf273ff3ba","repo":"sipeed/picoclaw","slug":"mcp-server-q-not-found","errorCode":null,"errorMessage":"MCP server %q not found","messagePattern":"MCP server %q not found","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/picoclaw/internal/mcp/remove.go","lineNumber":22,"sourceCode":"\t\"fmt\"\n\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newRemoveCommand() *cobra.Command {\n\treturn &cobra.Command{\n\t\tUse:   \"remove <name>\",\n\t\tShort: \"Remove an MCP server from config\",\n\t\tArgs:  cobra.ExactArgs(1),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tcfg, err := loadConfig()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tname := args[0]\n\t\t\tif _, exists := cfg.Tools.MCP.Servers[name]; !exists {\n\t\t\t\treturn fmt.Errorf(\"MCP server %q not found\", name)\n\t\t\t}\n\n\t\t\tdelete(cfg.Tools.MCP.Servers, name)\n\t\t\tif len(cfg.Tools.MCP.Servers) == 0 {\n\t\t\t\tcfg.Tools.MCP.Servers = nil\n\t\t\t\tcfg.Tools.MCP.Enabled = false\n\t\t\t}\n\n\t\t\tif err := saveValidatedConfig(cfg); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfmt.Fprintf(cmd.OutOrStdout(), \"✓ MCP server %q removed.\\n\", name)\n\t\t\treturn nil\n\t\t},\n\t}\n}\n","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/cmd/picoclaw/internal/mcp/remove.go#L4-L40","documentation":"Returned by picoclaw mcp remove <name> when the name is not a key under tools.mcp.servers in the loaded config. The lookup is an exact, case-sensitive map-key match, so any difference in spelling or case fails. Nothing is modified — the config is left untouched.","triggerScenarios":"picoclaw mcp remove with a typo'd or wrongly-cased name; removing a server that was already removed; picoclaw resolving a different config file than the one the server was added to (workspace-level vs user config).","commonSituations":"Scripts written against an old server name; multiple config files (project and global) causing confusion about where the entry lives; names with quotes or spaces pasted incorrectly; CI running with a fresh HOME and an empty config.","solutions":["List what is actually configured: picoclaw mcp list, and copy the exact key","Re-run picoclaw mcp remove <exact-name>","If the list is empty, determine which config file picoclaw loads for this directory and remove the entry there","As a last resort, edit the config file and delete the key under tools.mcp.servers manually"],"exampleFix":"# before\n$ picoclaw mcp remove Weather\nMCP server \"Weather\" not found\n\n# after\n$ picoclaw mcp list\nNAME      TYPE     ENABLED\nweather   stdio    true\n$ picoclaw mcp remove weather","handlingStrategy":"validation","validationCode":"cfg, err := loadConfig()\nif err != nil {\n  return err\n}\nif _, ok := cfg.Tools.MCP.Servers[name]; !ok {\n  names := make([]string, 0, len(cfg.Tools.MCP.Servers))\n  for k := range cfg.Tools.MCP.Servers {\n    names = append(names, k)\n  }\n  sort.Strings(names)\n  return fmt.Errorf(\"MCP server %q not found; configured servers: %v\", name, names)\n}","typeGuard":"func isMCPServerNotFound(err error) bool {\n  return err != nil && strings.Contains(err.Error(), \"MCP server\") && strings.Contains(err.Error(), \"not found\")\n}","tryCatchPattern":"if err := removeCmd.RunE(cmd, args); err != nil {\n  if isMCPServerNotFound(err) {\n    // list configured names and ask the user to pick, instead of failing\n  }\n  return err\n}","preventionTips":["Always derive server names from picoclaw mcp list output, not from memory or docs","Names are case-sensitive map keys — copy them exactly","In scripts, check existence with picoclaw mcp list before calling remove"],"tags":["cli","mcp","config","not-found"],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}