multica-ai/multica · error

--%s-stdin: empty input%s

Error message

--%s-stdin: empty input%s

What it means

Thrown when the --<prefix>-stdin flag is used and the stream is read successfully but contains only whitespace. Empty input is treated as a mistake rather than an implicit clear; the message includes a hint to pass 'null' when the flag supports clearing. Validation happens entirely client-side.

Source

Thrown at server/cmd/multica/cmd_agent.go:1407

		return nil, false, fmt.Errorf("--%s, --%s-stdin, and --%s-file are mutually exclusive; pick one", prefix, prefix, prefix)
	}

	clearHint := ""
	if allowNull {
		clearHint = "; pass 'null' to clear"
	}
	var raw string
	switch {
	case inline:
		raw, _ = cmd.Flags().GetString(prefix)
	case fromStdin:
		buf, err := io.ReadAll(cmd.InOrStdin())
		if err != nil {
			return nil, false, fmt.Errorf("read --%s-stdin: %w", prefix, err)
		}
		raw = string(buf)
		if strings.TrimSpace(raw) == "" {
			return nil, false, fmt.Errorf("--%s-stdin: empty input%s", prefix, clearHint)
		}
	case fromFile:
		if filePath == "" {
			return nil, false, fmt.Errorf("--%s-file: path must not be empty", prefix)
		}
		buf, err := os.ReadFile(filePath)
		if err != nil {
			// Filesystem errors may include the path but not the contents —
			// safe to surface via %w.
			return nil, false, fmt.Errorf("read --%s-file: %w", prefix, err)
		}
		raw = string(buf)
		if strings.TrimSpace(raw) == "" {
			return nil, false, fmt.Errorf("--%s-file %q: empty contents%s", prefix, filePath, clearHint)
		}
	}

	mc, err := parseMcpJSONObject("--"+prefix, raw, allowNull)

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Feed an actual JSON object on stdin: echo '{"servers": {}}' | multica ... --mcp-config-stdin
  2. To clear the field, pipe the literal null when the flag allows it: echo null | multica ... --mcp-config-stdin
  3. Debug the producer: run the piped command alone and confirm it prints non-empty JSON

Example fix

# before
echo "$CFG" | multica agent update <id> --mcp-config-stdin   # CFG unset
# after
CFG='{"servers": {}}'
echo "$CFG" | multica agent update <id> --mcp-config-stdin
Defensive patterns

Strategy: validation

Validate before calling

test -n "$(printf '%s' "$CFG" | tr -d '[:space:]')" || { echo "empty config" >&2; exit 1; }
printf '%s' "$CFG" | multica agent update <id> --mcp-config-stdin

Prevention

When it happens

Trigger: Running `multica agent update <id> --mcp-config-stdin < /dev/null`, piping an empty string (`echo '' | multica ... --mcp-config-stdin`), or piping output of a command that produced nothing.

Common situations: An upstream jq filter that matched nothing and printed empty output; a script variable that was never set; redirecting from an empty or truncated file; terminal users pressing Ctrl-D immediately.

Related errors


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