{"record":{"id":"996084c23dd815b6","repo":"multica-ai/multica","slug":"update-label-w","errorCode":null,"errorMessage":"update label: %w","messagePattern":"update label: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_label.go","lineNumber":229,"sourceCode":"\tlabelRef, err := resolveLabelID(ctx, client, args[0])\n\tif err != nil {\n\t\treturn fmt.Errorf(\"resolve label: %w\", err)\n\t}\n\n\tbody := map[string]any{}\n\tif v, _ := cmd.Flags().GetString(\"name\"); v != \"\" {\n\t\tbody[\"name\"] = v\n\t}\n\tif v, _ := cmd.Flags().GetString(\"color\"); v != \"\" {\n\t\tbody[\"color\"] = v\n\t}\n\tif len(body) == 0 {\n\t\treturn fmt.Errorf(\"nothing to update — provide --name and/or --color\")\n\t}\n\n\tvar result map[string]any\n\tif err := client.PutJSON(ctx, \"/api/labels/\"+labelRef.ID, body, &result); err != nil {\n\t\treturn fmt.Errorf(\"update label: %w\", err)\n\t}\n\n\toutput, _ := cmd.Flags().GetString(\"output\")\n\tif output == \"table\" {\n\t\theaders := []string{\"ID\", \"NAME\", \"COLOR\"}\n\t\trows := [][]string{{\n\t\t\tstrVal(result, \"id\"),\n\t\t\tstrVal(result, \"name\"),\n\t\t\tstrVal(result, \"color\"),\n\t\t}}\n\t\tcli.PrintTable(os.Stdout, headers, rows)\n\t\treturn nil\n\t}\n\treturn cli.PrintJSON(os.Stdout, result)\n}\n\nfunc runLabelDelete(cmd *cobra.Command, args []string) error {\n\tclient, err := newAPIClient(cmd)","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_label.go#L211-L247","documentation":"Wraps a failed PUT /api/labels/{labelID} during `multica label update`. Only the provided fields (name and/or color) are sent. The wrapped error reflects the server's response: duplicate name conflict, invalid color, auth failure, or transport error.","triggerScenarios":"Renaming a label to a name that already exists in the workspace; supplying a color the server rejects; 401/403; label deleted between resolve and PUT (race); network/server failure.","commonSituations":"Rename collisions with existing labels; stale credentials; concurrent label edits in a team.","solutions":["Check `multica label list` for the target name before renaming","Revert or pick a unique name on a duplicate-name error","Re-authenticate on 401; retry once on transient failures","Re-resolve the label if it may have been deleted mid-script"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"# bash: avoid rename collisions\nmultica label list --output json | jq -e --arg n \"$NEW_NAME\" '.[] | select(.name == $n)' >/dev/null \\\n  && { echo \"name $NEW_NAME already taken\" >&2; exit 2; } || true","typeGuard":null,"tryCatchPattern":"if err := client.PutJSON(ctx, \"/api/labels/\"+id, body, &result); err != nil {\n\tif isConflict(err) { /* pick a unique name */ }\n\tif isNotFound(err) { /* re-resolve the label */ }\n\treturn fmt.Errorf(\"update label: %w\", err)\n}","preventionTips":["Check name uniqueness before renames","Re-resolve stale IDs in long scripts","Re-login on 401"],"tags":["cli","http","labels"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}