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, nilView on GitHub (pinned to 2c0912b6ec)
Solutions
- Set the variable or pass a real path: --mcp-config-file ./config/mcp.json
- Guard in the script: only pass the flag when the variable is non-empty
- 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
- Use set -u so empty variables abort the script
- Build flag arrays conditionally: [ -n "$VAR" ] && args+=(--mcp-config-file "$VAR")
- Never pass ${VAR:-} style defaults to path flags
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
- --runtime-id must not be empty
- --%s, --%s-stdin, and --%s-file are mutually exclusive; pick
- --name must not be empty
- --runtime-config must be valid JSON: %w
- --max-concurrent-tasks %w (got %d)
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/4e0f5e33b621c6c8.
Report an issue: GitHub.