{"record":{"id":"0b4e216ca6cb6d3c","repo":"sipeed/picoclaw","slug":"aborted-mcp-server-q-already-exists","errorCode":null,"errorMessage":"aborted: MCP server %q already exists","messagePattern":"aborted: MCP server %q already exists","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"cmd/picoclaw/internal/mcp/add.go","lineNumber":52,"sourceCode":"\t\t\t}\n\n\t\t\tcfg, err := loadConfig()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif cfg.Tools.MCP.Servers == nil {\n\t\t\t\tcfg.Tools.MCP.Servers = make(map[string]config.MCPServerConfig)\n\t\t\t}\n\n\t\t\tif _, exists := cfg.Tools.MCP.Servers[name]; exists && !opts.Force {\n\t\t\t\tvar overwrite bool\n\n\t\t\t\toverwrite, err = confirmOverwrite(cmd.InOrStdin(), cmd.OutOrStdout(), name)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"failed to confirm overwrite: %w\", err)\n\t\t\t\t}\n\t\t\t\tif !overwrite {\n\t\t\t\t\treturn fmt.Errorf(\"aborted: MCP server %q already exists\", name)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tserver, err := buildServerConfig(target, targetArgs, opts)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tcfg.Tools.MCP.Enabled = true\n\t\t\tcfg.Tools.MCP.Servers[name] = server\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 saved.\\n\", name)\n\t\t\treturn nil\n\t\t},","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/cmd/picoclaw/internal/mcp/add.go#L34-L70","documentation":"The target MCP server name already exists in cfg.Tools.MCP.Servers, --force was not given, and the overwrite prompt was answered with anything other than y/yes (or stdin hit EOF, which counts as 'no'). This is a deliberate user abort: the config is unchanged and nothing was written.","triggerScenarios":"`picoclaw mcp add <existing-name> ...` without -f, then answering 'n' or 'no', or feeding EOF (Ctrl-D) at the prompt.","commonSituations":"Retrying an add that already succeeded; wanting to edit rather than replace; wrong name chosen on purpose to back out.","solutions":["Re-run with `--force` (`-f`) if you intend to replace the entry","Pick a different <name> if you want both servers","Answer y at the prompt to overwrite","To change one field of the existing server, edit the config instead of re-adding"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# check existence first so the prompt (and abort) never happens\npicoclaw mcp list | grep -q \"^\\s*<name>\\b\" && echo \"exists: pass --force or pick a new name\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Names are unique keys: check `picoclaw mcp list` before add in automation","Pass --force when the intent is replace","Treat exit-with-this-message as a no-op, not a failure, in scripts"],"tags":["mcp","cli","interactive","abort"],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}