multica-ai/multica · error

invalid --direction %q; valid values: asc, desc

Error message

invalid --direction %q; valid values: asc, desc

What it means

The --direction flag passed to `multica issue list` is neither asc nor desc (compared case-insensitively after ToLower). This is a client-side check that runs before the sort/direction combination check, so any other value fails immediately.

Source

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

	}
	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)
	}

	path := "/api/issues"
	if len(params) > 0 {
		path += "?" + params.Encode()
	}

	var result map[string]any
	if err := client.GetJSON(ctx, path, &result); err != nil {

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Pass exactly asc or desc (any case works since it is lowercased first).
  2. Check for invisible whitespace when the value comes from a variable: --direction "${D// /}".
  3. If you only care about the default board order, drop --direction entirely.

Example fix

# before
multica issue list --direction ascending
# after
multica issue list --direction asc
Defensive patterns

Strategy: validation

Validate before calling

case "${DIRECTION,,}" in asc|desc) ;; *) echo "bad --direction: $DIRECTION" >&2; exit 1;; esac

Prevention

When it happens

Trigger: Running `multica issue list --direction ascending`, --direction DESCENDING, --direction "asc " (the value is lowercased but not trimmed, so stray whitespace still fails), or --direction -1.

Common situations: Scripts copying direction words from another tool's vocabulary (ascending/descending, 0/1); shell quoting that drags in whitespace; docs examples from a different CLI.

Related errors


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