multica-ai/multica · error

--before requires an issue ID or key

Error message

--before requires an issue ID or key

What it means

In runIssueReorder, --before was present (Changed) but its value was empty — e.g. from an unset shell variable. Cobra keys off flag presence, not value, so this case slips past the flag group and is guarded here.

Solutions

  1. Pass an issue ID or key to --before.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/cmd/multica/cmd_issue.go:1534 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

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

// (status) is left untouched, so cross-column moves still go through
// `issue status`.
func runIssueReorder(cmd *cobra.Command, args []string) error {
	before, _ := cmd.Flags().GetString("before")
	after, _ := cmd.Flags().GetString("after")
	top, _ := cmd.Flags().GetBool("top")
	bottom, _ := cmd.Flags().GetBool("bottom")

	// "Exactly one of --before/--after/--top/--bottom" is enforced declaratively
	// by the command's mutually-exclusive, one-required flag group (see
	// registerIssueReorderFlags), so cobra rejects zero-target and multi-target
	// invocations before RunE runs. Cobra keys off flag *presence* (Changed),
	// not value, so guard the cases it cannot see: a --before/--after passed
	// empty (e.g. an unset shell variable), or a --top/--bottom explicitly set
	// to false (e.g. `--top=false` from a generated command). Each counts as
	// "set" for the group yet selects no real target, and would otherwise fall
	// through to a confusing "not found in column" error.
	if cmd.Flags().Changed("before") && before == "" {
		return fmt.Errorf("--before requires an issue ID or key")
	}
	if cmd.Flags().Changed("after") && after == "" {
		return fmt.Errorf("--after requires an issue ID or key")
	}
	if cmd.Flags().Changed("top") && !top {
		return fmt.Errorf("--top cannot be set to false; pass it on its own to move the issue to the top of its column")
	}
	if cmd.Flags().Changed("bottom") && !bottom {
		return fmt.Errorf("--bottom cannot be set to false; pass it on its own to move the issue to the bottom of its column")
	}

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

	ctx, cancel := cli.APIContext(context.Background())
	defer cancel()

View on GitHub (pinned to 2c0912b6ec)