multica-ai/multica · error

update property: %w

Error message

update property: %w

What it means

Returned by `multica property update` when its PATCH to `/api/properties/<id>` fails. The %w wrap preserves the HTTP client's cause (auth, connectivity, or a 4xx/5xx response such as invalid option config or name conflicts).

Source

Thrown at server/cmd/multica/cmd_property.go:384

	if cmd.Flags().Changed("description") {
		description, _ := cmd.Flags().GetString("description")
		body["description"] = description
	}
	if cmd.Flags().Changed("icon") {
		icon, _ := cmd.Flags().GetString("icon")
		body["icon"] = icon
	}
	if cmd.Flags().Changed("option") {
		optionFlags, _ := cmd.Flags().GetStringArray("option")
		body["config"] = map[string]any{"options": parseOptionFlags(optionFlags, property.Config.Options)}
	}
	if len(body) == 0 {
		return fmt.Errorf("nothing to update; pass --name, --description, --icon, or --option")
	}

	var updated propertyDTO
	if err := client.PatchJSON(ctx, "/api/properties/"+property.ID, body, &updated); err != nil {
		return fmt.Errorf("update property: %w", err)
	}
	output, _ := cmd.Flags().GetString("output")
	if output == "json" {
		return cli.PrintJSON(os.Stdout, updated)
	}
	fmt.Fprintf(os.Stdout, "Property %q updated.\n", updated.Name)
	printPropertyTable([]propertyDTO{updated})
	return nil
}

func makePropertyArchiveRun(archive bool) func(*cobra.Command, []string) error {
	return func(cmd *cobra.Command, args []string) error {
		client, err := newAPIClient(cmd)
		if err != nil {
			return err
		}
		ctx, cancel := cli.APIContext(context.Background())
		defer cancel()

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Inspect the wrapped message for the HTTP status: 401/403 → re-authenticate; 400 → fix the flag payload (name/icon/option syntax).
  2. Confirm the target property ref resolves (`multica property list`) — though ref resolution usually fails earlier with a different message.
  3. Retry after fixing connectivity/token if the wrapped error is a network failure.

Example fix

// before
multica property update Priority --option "bogus=~=x"
// error: update property: request failed: 400 ...

// after
multica property update Priority --option "P0" --option "P1" --option "P2#fff000"
Defensive patterns

Strategy: try-catch

Validate before calling

# bash: dry-check the property exists before patching
multica property list | grep -qw "$PROP" || { echo "unknown property: $PROP" >&2; exit 1; }

Try / catch

if err := client.PatchJSON(ctx, path, body, &updated); err != nil {
    if isAuthError(err) { reauthenticate(); retry once }
    if isClientError(err) { surface flag problem; do not retry }
    return fmt.Errorf("update property: %w", err)
}

Prevention

When it happens

Trigger: PATCHing with an invalid `--icon` value, renaming to a name the server rejects or that collides, sending `--option` flags that produce a config the server refuses (400), expired credentials (401), or server down.

Common situations: Renaming a property to an existing name; passing option flags with malformed syntax so `parseOptionFlags` builds a bad config; stale auth token; server restarted mid-script.

Related errors


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