multica-ai/multica · error

stdin content for --%s is empty

Error message

stdin content for --%s is empty

What it means

Returned by the shared text-source helper when --flag-stdin is used and stdin reads successfully but contains only whitespace-trimmed-to-empty content (a trailing newline is stripped, then the body is empty). An explicitly empty stdin is treated as a probable mistake rather than an intentional empty value.

Source

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

	}
	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)
		if err != nil {
			return "", false, fmt.Errorf("read file for --%s: %w", fileFlag, err)
		}
		body := strings.TrimSuffix(string(data), "\n")
		if body == "" {
			return "", false, fmt.Errorf("file content for --%s is empty", fileFlag)
		}
		return body, true, nil
	}
	if inline == "" {

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Ensure the producer of the piped data actually writes non-empty content; check the upstream command's output independently
  2. If the value can legitimately be empty, omit the stdin flag entirely instead of passing empty stdin
  3. In scripts, guard with a non-empty check before invoking: test -s file || exit 1

Example fix

# before
printf '\n' | multica issue create --title "T" --description-stdin
# error: stdin content for --description-stdin is empty

# after
printf 'Real description\n' | multica issue create --title "T" --description-stdin
Defensive patterns

Strategy: validation

Validate before calling

# bash: only pipe when the producer emitted content
body="$(upstream_command)"
if [[ -n "$body" ]]; then
    printf '%s\n' "$body" | multica issue create --title "$t" --description-stdin
else
    echo "upstream produced no description" >&2; exit 1
fi

Prevention

When it happens

Trigger: Piping an empty string or only newlines into a --*-stdin flag: echo "" | multica issue create --description-stdin, or redirecting an empty file, or an upstream command that produced no output while still succeeding.

Common situations: Upstream command in a pipeline succeeded but emitted nothing (empty query result, empty variable); empty temp files from earlier failed steps; test fixtures that forgot to populate stdin.

Related errors


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