multica-ai/multica · error

invalid --sort %q; valid values: %s

Error message

invalid --sort %q; valid values: %s

What it means

The --sort flag passed to `multica issue list` is not one of the recognized sort columns (validIssueSortColumns). Validation is client-side and happens before the query is sent, so no API request is wasted on a bad column name.

Source

Thrown at server/cmd/multica/cmd_issue.go:649

	}
	if mdFlags, _ := cmd.Flags().GetStringSlice("metadata"); len(mdFlags) > 0 {
		filter, err := buildMetadataFilterQueryParam(mdFlags)
		if err != nil {
			return err
		}
		params.Set("metadata", filter)
	}
	sortVal, _ := cmd.Flags().GetString("sort")
	if sortVal != "" {
		valid := false
		for _, c := range validIssueSortColumns {
			if c == sortVal {
				valid = true
				break
			}
		}
		if !valid {
			return fmt.Errorf("invalid --sort %q; valid values: %s", sortVal, strings.Join(validIssueSortColumns, ", "))
		}
		params.Set("sort", sortVal)
	}
	if v, _ := cmd.Flags().GetString("direction"); v != "" {
		d := strings.ToLower(v)
		if d != "asc" && d != "desc" {
			return fmt.Errorf("invalid --direction %q; valid values: asc, desc", v)
		}
		// position (the manual board order) is always ascending, so the server
		// ignores --direction for it. Reject the combination up front rather
		// than silently dropping the flag — a passed-but-ignored flag is a
		// footgun, especially in scripts.
		if sortVal == "" || sortVal == "position" {
			return fmt.Errorf("--direction requires --sort to be one of %s; position (the default manual board order) is always ascending", strings.Join(directionalIssueSortColumns, ", "))
		}
		params.Set("direction", d)
	}

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Use one of the values printed in the error message exactly (no abbreviation, correct case).
  2. Omit --sort to get the default manual board order (position).
  3. If you believe the column should be sortable, check the CLI's documented/help list — the valid set is fixed in validIssueSortColumns.

Example fix

# before
multica issue list --sort created
# after
multica issue list --sort created_at
Defensive patterns

Strategy: validation

Validate before calling

# shell: whitelist the sort column before the call
 case "$SORT" in created_at|updated_at|priority|status) ;; *) echo "bad --sort: $SORT" >&2; exit 1;; esac
# mirror the exact set the error message prints

Type guard

func isValidSort(col string, valid []string) bool {
	for _, v := range valid {
		if col == v {
			return true
		}
	}
	return false
}

Prevention

When it happens

Trigger: Running `multica issue list --sort created` (instead of created_at), --sort title, --sort updated (vs updated_at), or any column name not in the valid set. Case matters: the comparison is exact string equality.

Common situations: Guessing column names from the JSON output fields (which may differ from sortable columns); scripts written against an older/newer CLI whose sort set changed; abbreviations like 'prio'.

Related errors


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