{"record":{"id":"de3d8d4e694d8ffe","repo":"multica-ai/multica","slug":"update-workspace-mcp-server-w","errorCode":null,"errorMessage":"update workspace mcp server: %w","messagePattern":"update workspace mcp server: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_workspace.go","lineNumber":708,"sourceCode":"\tif ok {\n\t\tbody[\"config\"] = entry\n\t}\n\tif len(body) == 0 {\n\t\treturn fmt.Errorf(\"nothing to update; pass --name and/or one of --server-config, --server-config-stdin, --server-config-file\")\n\t}\n\n\tclient, err := newAPIClient(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tctx, cancel := cli.APIContext(context.Background())\n\tdefer cancel()\n\n\tvar server workspaceMcpServer\n\tpath := \"/api/workspaces/\" + wsID + \"/mcp-servers/\" + url.PathEscape(serverID)\n\tif err := client.PutJSON(ctx, path, body, &server); err != nil {\n\t\treturn fmt.Errorf(\"update workspace mcp server: %w\", err)\n\t}\n\n\treturn printWorkspaceMcpServers(cmd, []workspaceMcpServer{server})\n}\n\nfunc runWorkspaceMcpRemove(cmd *cobra.Command, args []string) error {\n\tserverID := strings.TrimSpace(args[0])\n\tif serverID == \"\" {\n\t\treturn fmt.Errorf(\"server ID must not be empty\")\n\t}\n\twsID, err := resolveWorkspaceArg(cmd, args[1:])\n\tif err != nil {\n\t\treturn err\n\t}\n\tif wsID == \"\" {\n\t\treturn fmt.Errorf(\"workspace ID is required: pass an id/slug/prefix as argument or set MULTICA_WORKSPACE_ID\")\n\t}\n","sourceCodeStart":690,"sourceCodeEnd":726,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_workspace.go#L690-L726","documentation":"Wrapped failure of the HTTP PUT to /api/workspaces/{id}/mcp-servers/{serverId} performed by `multica workspace mcp update`. Note the server ID is URL-path-escaped (url.PathEscape) before the call. The chained cause is typically 404 (unknown server ID or workspace), 400 (invalid new config/name), or auth/network errors.","triggerScenarios":"Updating a server ID that no longer exists (already removed), renaming to a name that collides with another server (409), submitting config JSON that fails validation, or using an ID obtained from a different workspace.","commonSituations":"Stale server ID captured in a script before someone removed/re-added the server; editing config files between list and update; wrong workspace argument so the ID does not exist there.","solutions":["Re-list servers to get the current ID: `multica workspace mcp list <ws>`, then re-run update with that ID","Read the wrapped error body — 400 pinpoints the invalid config field","For 409 name conflicts, choose a different --name or rename the conflicting entry first","Ensure the workspace argument matches the one the server was registered under"],"exampleFix":"# before\nmultica workspace mcp update 17 acme --server-config-file cfg.json\n# update workspace mcp server: 404\n\n# after\nmultica workspace mcp list acme   # server was re-added, new ID 23\nmultica workspace mcp update 23 acme --server-config-file cfg.json","handlingStrategy":"try-catch","validationCode":"// refresh the ID right before updating\nservers, err := listServers(ctx, wsID)\nif err != nil {\n    return err\n}\nvar current string\nfor _, s := range servers {\n    if s.Name == wantName {\n        current = s.ID\n    }\n}\nif current == \"\" {\n    return fmt.Errorf(\"no server named %q in workspace\", wantName)\n}","typeGuard":null,"tryCatchPattern":"if err := client.PutJSON(ctx, path, body, &server); err != nil {\n    var httpErr *apiclient.HTTPError\n    if errors.As(err, &httpErr) && httpErr.StatusCode == 404 {\n        // entry was removed; fall back to add\n        return client.PostJSON(ctx, basePath, body, &server)\n    }\n    return fmt.Errorf(\"update workspace mcp server: %w\", err)\n}","preventionTips":["List-then-update in one script step so IDs are never stale","Validate config JSON against the transport's required keys before sending","Avoid renaming to names already used by sibling servers"],"tags":["cli","http","mcp","api-client"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}