multica-ai/multica · error

--%s-file: path must not be empty

Error message

--%s-file: path must not be empty

What it means

Thrown when --<prefix>-file is set but its value is the empty string. The CLI checks the path before attempting os.ReadFile, so no filesystem access happens. Almost always caused by an empty shell variable being expanded into the flag.

Source

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

	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)
	if err != nil {
		return nil, false, err
	}
	return mc, true, nil

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Set the variable or pass a real path: --mcp-config-file ./config/mcp.json
  2. Guard in the script: only pass the flag when the variable is non-empty
  3. If the field should be cleared, use the null sentinel on the inline/stdin variants instead of an empty file flag

Example fix

# before
multica agent update <id> --mcp-config-file "$MCP_FILE"  # MCP_FILE=""
# after
MCP_FILE=./config/mcp.json
multica agent update <id> --mcp-config-file "$MCP_FILE"
Defensive patterns

Strategy: validation

Validate before calling

if [ -n "${CFG_FILE:-}" ]; then
  multica agent update <id> --mcp-config-file "$CFG_FILE"
else
  multica agent update <id>
fi

Prevention

When it happens

Trigger: `multica agent update <id> --mcp-config-file "$CFG_FILE"` where CFG_FILE is unset/empty; scripts with `--mcp-config-file=${CFG:-}` patterns; flag value consisting only of nothing after shell expansion.

Common situations: Optional configuration variable never initialized; a CI job that only sets the variable on one branch of the pipeline; typo'd variable name that expands to empty.

Related errors


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