multica-ai/multica · error

update workspace mcp server: %w

Error message

update workspace mcp server: %w

What it means

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.

Source

Thrown at server/cmd/multica/cmd_workspace.go:708

	if ok {
		body["config"] = entry
	}
	if len(body) == 0 {
		return fmt.Errorf("nothing to update; pass --name and/or one of --server-config, --server-config-stdin, --server-config-file")
	}

	client, err := newAPIClient(cmd)
	if err != nil {
		return err
	}

	ctx, cancel := cli.APIContext(context.Background())
	defer cancel()

	var server workspaceMcpServer
	path := "/api/workspaces/" + wsID + "/mcp-servers/" + url.PathEscape(serverID)
	if err := client.PutJSON(ctx, path, body, &server); err != nil {
		return fmt.Errorf("update workspace mcp server: %w", err)
	}

	return printWorkspaceMcpServers(cmd, []workspaceMcpServer{server})
}

func runWorkspaceMcpRemove(cmd *cobra.Command, args []string) error {
	serverID := strings.TrimSpace(args[0])
	if serverID == "" {
		return fmt.Errorf("server ID must not be empty")
	}
	wsID, err := resolveWorkspaceArg(cmd, args[1:])
	if err != nil {
		return err
	}
	if wsID == "" {
		return fmt.Errorf("workspace ID is required: pass an id/slug/prefix as argument or set MULTICA_WORKSPACE_ID")
	}

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Re-list servers to get the current ID: `multica workspace mcp list <ws>`, then re-run update with that ID
  2. Read the wrapped error body — 400 pinpoints the invalid config field
  3. For 409 name conflicts, choose a different --name or rename the conflicting entry first
  4. Ensure the workspace argument matches the one the server was registered under

Example fix

# before
multica workspace mcp update 17 acme --server-config-file cfg.json
# update workspace mcp server: 404

# after
multica workspace mcp list acme   # server was re-added, new ID 23
multica workspace mcp update 23 acme --server-config-file cfg.json
Defensive patterns

Strategy: try-catch

Validate before calling

// refresh the ID right before updating
servers, err := listServers(ctx, wsID)
if err != nil {
    return err
}
var current string
for _, s := range servers {
    if s.Name == wantName {
        current = s.ID
    }
}
if current == "" {
    return fmt.Errorf("no server named %q in workspace", wantName)
}

Try / catch

if err := client.PutJSON(ctx, path, body, &server); err != nil {
    var httpErr *apiclient.HTTPError
    if errors.As(err, &httpErr) && httpErr.StatusCode == 404 {
        // entry was removed; fall back to add
        return client.PostJSON(ctx, basePath, body, &server)
    }
    return fmt.Errorf("update workspace mcp server: %w", err)
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15). Data as JSON: /api/errors/de3d8d4e694d8ffe. Report an issue: GitHub.