multica-ai/multica · error

update workspace: %w

Error message

update workspace: %w

What it means

Wrapped failure of the HTTP PATCH to /api/workspaces/{id} performed by `multica workspace update`. The underlying cause — validation rejection (400), unknown workspace (404), auth failure (401/403), conflict (409, e.g. slug or prefix already taken), or network error — is preserved via %w.

Source

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

	body, err := buildWorkspaceUpdateBody(cmd)
	if err != nil {
		return err
	}
	if len(body) == 0 {
		return fmt.Errorf("no fields to update; use --name, --description, --context, or --issue-prefix")
	}

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

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

	var ws map[string]any
	if err := client.PatchJSON(ctx, "/api/workspaces/"+wsID, body, &ws); err != nil {
		return fmt.Errorf("update workspace: %w", err)
	}

	return printWorkspace(cmd, ws)
}

func runWorkspaceMcpList(cmd *cobra.Command, args []string) error {
	wsID, err := resolveWorkspaceArg(cmd, args)
	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")
	}

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

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Read the wrapped error text — the server's status code and message identify whether it is validation (400), not-found (404), or conflict (409)
  2. For 400/409, adjust the field values (e.g. pick a unique issue-prefix) and re-run
  3. For 404, resolve the current identifier via `multica workspace list`
  4. For 401/403, fix the token or use an account with owner/admin role on the workspace

Example fix

# before
multica workspace update acme --issue-prefix MULT
# update workspace: 409 issue prefix already in use

# after
multica workspace update acme --issue-prefix ACM
Defensive patterns

Strategy: try-catch

Validate before calling

if len(body) == 0 {
    return errors.New("nothing to update")
}
// pre-validate unique-ish values client-side to reduce 409s
if p, ok := body["issue_prefix"].(string); ok && len(p) > 8 {
    return errors.New("issue prefix too long; pick a shorter one")
}

Try / catch

if err := client.PatchJSON(ctx, path, body, &ws); err != nil {
    var httpErr *apiclient.HTTPError
    if errors.As(err, &httpErr) {
        if httpErr.StatusCode == 409 {
            // pick another value and let the caller retry once
            return retryWithNewPrefix(body)
        }
    }
    return fmt.Errorf("update workspace: %w", err)
}

Prevention

When it happens

Trigger: Updating a workspace with an invalid new name/slug/prefix (server-side 400), a duplicate issue-prefix (409), a nonexistent id/slug, insufficient member role, or an unreachable server.

Common situations: Trying to set an issue prefix another workspace already owns; renaming to a reserved or malformed slug; stale identifier after the workspace was deleted; read-only member attempting an update.

Related errors


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