multica-ai/multica · error

set property: %w

Error message

set property: %w

What it means

Returned by `runIssuePropertySet` when the PUT to `/api/issues/<issueID>/properties/<propertyID>` with `{"value": ...}` fails. Local encoding already succeeded (option IDs resolved, number/bool validated), so the failure is server-side: permissions, further validation, or transport.

Source

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

	properties, err := fetchProperties(ctx, client)
	if err != nil {
		return err
	}
	property, err := resolvePropertyRef(properties, name)
	if err != nil {
		return err
	}
	value, err := encodeIssuePropertyValue(property, rawValue)
	if err != nil {
		return err
	}

	var result struct {
		Properties map[string]any `json:"properties"`
	}
	path := "/api/issues/" + issueRef.ID + "/properties/" + property.ID
	if err := client.PutJSON(ctx, path, map[string]any{"value": value}, &result); err != nil {
		return fmt.Errorf("set property: %w", err)
	}
	rows := buildIssuePropertyRows(properties, result.Properties)
	output, _ := cmd.Flags().GetString("output")
	if output == "json" {
		return cli.PrintJSON(os.Stdout, rows)
	}
	printIssuePropertyRows(rows)
	return nil
}

func runIssuePropertyUnset(cmd *cobra.Command, args []string) error {
	name, _ := cmd.Flags().GetString("name")
	if name == "" {
		return fmt.Errorf("--name is required")
	}

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

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Read the wrapped error: 400/422 → re-fetch the property (`multica property list`) to confirm it and its options are current, then retry.
  2. 401/403 → re-authenticate the CLI.
  3. Network failure → verify server reachability and retry.

Example fix

// before
multica issue property set ISS-1 --name Priority --value P0
// error: set property: request failed: 422 ...

// after
multica property list   # confirm property + options are active and current
multica issue property set ISS-1 --name Priority --value P0
Defensive patterns

Strategy: try-catch

Validate before calling

# bash: pre-check property + option freshness so the server is unlikely to reject
multica property list --output json | jq -e --arg p "$PROP" --arg o "$VAL" '.[] | select(.name==$p) | .options[]?.name == $o' >/dev/null || { echo 'stale property/option' >&2; exit 1; }

Try / catch

if err := client.PutJSON(ctx, path, map[string]any{"value": value}, &result); err != nil {
    if isValidationError(err) { // refresh property list, re-encode, retry once }
    return fmt.Errorf("set property: %w", err)
}

Prevention

When it happens

Trigger: Server rejects the encoded value (e.g. archived property or option, type constraint beyond CLI checks, value locked by workflow state), 401/403, or network failure during the PUT.

Common situations: Setting a value on an archived property; options renamed server-side after the CLI fetched the property list; token expiry mid-script.

Related errors


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