multica-ai/multica · error
set metadata: %w
Error message
set metadata: %w
What it means
Wraps a failed HTTP PUT to /api/issues/{issueID}/metadata/{key} during `multica issue metadata set`. The inner error comes from the CLI's PutJSON helper and reflects the server's response: auth failure, validation of the typed value, workspace mismatch, or connectivity problems.
Source
Thrown at server/cmd/multica/cmd_issue_metadata.go:282
}
client, err := newAPIClient(cmd)
if err != nil {
return err
}
ctx, cancel := cli.APIContext(context.Background())
defer cancel()
issueRef, err := resolveIssueRef(ctx, client, args[0])
if err != nil {
return fmt.Errorf("resolve issue: %w", err)
}
body := map[string]any{"value": value}
var result map[string]any
path := "/api/issues/" + issueRef.ID + "/metadata/" + key
if err := client.PutJSON(ctx, path, body, &result); err != nil {
return fmt.Errorf("set metadata: %w", err)
}
metadata, _ := result["metadata"].(map[string]any)
output, _ := cmd.Flags().GetString("output")
if output == "json" {
return cli.PrintJSON(os.Stdout, metadata)
}
printMetadataTable(metadata)
return nil
}
func runIssueMetadataDelete(cmd *cobra.Command, args []string) error {
key, _ := cmd.Flags().GetString("key")
if key == "" {
return fmt.Errorf("--key is required")
}
client, err := newAPIClient(cmd)View on GitHub (pinned to 2c0912b6ec)
Solutions
- Inspect the wrapped error text — it includes the server's HTTP status and message
- If type-conflicted, clear the old entry (`multica issue metadata delete ISSUE --key k`) then set again with the correct --type
- Re-authenticate with `multica login` if the error is a 401
- Retry after transient network failures; re-resolve the issue if it may have been deleted
Defensive patterns
Strategy: retry
Try / catch
if err := client.PutJSON(ctx, path, body, &result); err != nil {
status := cli.HTTPStatus(err) // extract wrapped status if available
if status == 401 { /* re-auth then retry once */ }
if isTransient(err) { /* backoff and retry once */ }
return fmt.Errorf("set metadata: %w", err)
} Prevention
- Keep --type consistent for a given key across writes
- Re-login before long batch runs to avoid mid-run 401s
- On type conflicts, delete the key first then re-set
When it happens
Trigger: PUT returns 4xx/5xx — e.g. invalid value for the declared --type (parseMetadataValue passed locally but server rejects), metadata key collisions with type conflicts, expired token (401), no permission on the issue (403), or the issue having been deleted between resolve and PUT.
Common situations: Setting a metadata key that already exists with a different type; stale auth credentials; server-side schema constraints on metadata; network interruptions mid-request.
Related errors
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/52bf93c6258f397e.
Report an issue: GitHub.