multica-ai/multica · error

--%s, --%s, and --%s are mutually exclusive

Error message

--%s, --%s, and --%s are mutually exclusive

What it means

Returned by the shared text-source helper (used by issue body/description flags) when more than one of the three input sources is set: an inline --flag value, its --flag-stdin variant, and its --flag-file variant. The helper counts set sources and rejects combinations so input provenance is unambiguous.

Source

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

func resolveTextFlag(cmd *cobra.Command, flagName string) (string, bool, error) {
	stdinFlag := flagName + "-stdin"
	fileFlag := flagName + "-file"
	useStdin, _ := cmd.Flags().GetBool(stdinFlag)
	inline, _ := cmd.Flags().GetString(flagName)
	filePath, _ := cmd.Flags().GetString(fileFlag)

	sources := 0
	if useStdin {
		sources++
	}
	if inline != "" {
		sources++
	}
	if filePath != "" {
		sources++
	}
	if sources > 1 {
		return "", false, fmt.Errorf("--%s, --%s, and --%s are mutually exclusive", flagName, stdinFlag, fileFlag)
	}

	if useStdin {
		data, err := io.ReadAll(os.Stdin)
		if err != nil {
			return "", false, fmt.Errorf("read stdin for --%s: %w", stdinFlag, err)
		}
		body := strings.TrimSuffix(string(data), "\n")
		if body == "" {
			return "", false, fmt.Errorf("stdin content for --%s is empty", stdinFlag)
		}
		return body, true, nil
	}
	if filePath != "" {
		if err := ensureFileFlagWithinWorkdir(cmd, fileFlag, flagName, filePath); err != nil {
			return "", false, err
		}
		data, err := os.ReadFile(filePath)

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Keep exactly one source per value: inline flag, stdin variant, or file variant — remove the extras
  2. For scripts, default the flags to empty strings and set only one conditionally
  3. Check the command line with multica <cmd> --help to confirm which three flags the message names (flagName, stdinFlag, fileFlag are interpolated)

Example fix

# before
multica issue create --title "Fix" --description "inline" --description-file body.txt
# error: --description, --description-stdin, and --description-file are mutually exclusive

# after
multica issue create --title "Fix" --description-file body.txt
Defensive patterns

Strategy: validation

Validate before calling

// count sources exactly like the CLI does
sources := 0
if inline != "" { sources++ }
if useStdin { sources++ }
if filePath != "" { sources++ }
if sources > 1 {
    return fmt.Errorf("pick one of --%s, --%s, --%s", flagName, stdinFlag, fileFlag)
}

Prevention

When it happens

Trigger: Invoking an issue command with, e.g., both --description "text" and --description-file body.txt, or --label-stdin plus an inline --label value — any two or three of the mutually exclusive trio set simultaneously.

Common situations: Copy-pasted command lines accumulated flags over time; shell scripts that always pass defaults plus user overrides; wrappers that forward both a stdin pipe and a file argument on the same invocation.

Related errors


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