multica-ai/multica · error
read --%s-stdin: %w
Error message
read --%s-stdin: %w
What it means
Thrown when reading the --<prefix>-stdin stream with io.ReadAll fails. This means the operating system or shell failed while delivering stdin — not that the content is invalid. The underlying error is wrapped with %w so the OS cause (e.g. broken pipe, I/O error) is visible in the chain.
Source
Thrown at server/cmd/multica/cmd_agent.go:1403
switch {
case count == 0:
return nil, false, nil
case count > 1:
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)View on GitHub (pinned to 2c0912b6ec)
Solutions
- Fix the upstream command in the pipe — run it alone and confirm it exits 0 before piping into the CLI
- Write the payload to a file and use --<prefix>-file instead, which removes the pipe dependency
- Pass the value inline with --<prefix> if it is small enough
Example fix
# before curl -s https://example.com/cfg.json | multica agent update <id> --mcp-config-stdin # after curl -fsS https://example.com/cfg.json -o /tmp/cfg.json && multica agent update <id> --mcp-config-file /tmp/cfg.json
Defensive patterns
Strategy: try-catch
Try / catch
In Go code embedding the CLI or equivalent pipe logic: data, err := io.ReadAll(stdin); if err != nil { log.Fatalf("read stdin: %v", err) } — always branch on the error instead of assuming pipes deliver data. Prevention
- Use --<prefix>-file for anything fetched over the network instead of piping
- Set pipefail in bash scripts so upstream failures surface before the CLI runs
- Prefer files over pipes in CI where stdin handling is unreliable
When it happens
Trigger: Running `multica agent update <id> --mcp-config-stdin` where the producer of stdin dies mid-write (e.g. `curl ... | multica ... --mcp-config-stdin` and curl fails), reading from a closed pipe, or stdin being a descriptor in an error state.
Common situations: Piping a failing curl/jq/cat into the CLI; running under a process supervisor that closes stdin unexpectedly; a CI runner that provides no usable stdin and the pipe errors instead of staying open.
Related errors
- read stdin for --content-stdin: %w
- --%s-stdin: empty input%s
- read --%s-file: %w
- read stdin for --%s: %w
- --months-back=%d would skip buckets before %s (oldest availa
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/fc97f0a1d3e0a8ba.
Report an issue: GitHub.