{"record":{"id":"8e4a97185872ec2b","repo":"multica-ai/multica","slug":"read-stdin-for-content-stdin-w","errorCode":null,"errorMessage":"read stdin for --content-stdin: %w","messagePattern":"read stdin for --content-stdin: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_skill.go","lineNumber":204,"sourceCode":"\n\tsources := 0\n\tif inlineSet {\n\t\tsources++\n\t}\n\tif useStdin {\n\t\tsources++\n\t}\n\tif filePath != \"\" {\n\t\tsources++\n\t}\n\tif sources > 1 {\n\t\treturn \"\", false, fmt.Errorf(\"--content, --content-stdin, and --content-file are mutually exclusive\")\n\t}\n\n\tif useStdin {\n\t\tdata, err := io.ReadAll(os.Stdin)\n\t\tif err != nil {\n\t\t\treturn \"\", false, fmt.Errorf(\"read stdin for --content-stdin: %w\", err)\n\t\t}\n\t\treturn skillContentBytesToString(data, \"stdin content for --content-stdin\")\n\t}\n\tif filePath != \"\" {\n\t\tdata, err := os.ReadFile(filePath)\n\t\tif err != nil {\n\t\t\treturn \"\", false, fmt.Errorf(\"read file for --content-file: %w\", err)\n\t\t}\n\t\treturn skillContentBytesToString(data, \"file content for --content-file\")\n\t}\n\tif inlineSet {\n\t\treturn inline, true, nil\n\t}\n\treturn \"\", false, nil\n}\n\nfunc skillContentBytesToString(data []byte, label string) (string, bool, error) {\n\tif len(data) == 0 {","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_skill.go#L186-L222","documentation":"Returned when --content-stdin is used and io.ReadAll(os.Stdin) fails before the content can be validated. This is a low-level stdin read failure (not empty input — empty input is a separate '%s is empty' error). The %w wraps the OS-level read error.","triggerScenarios":"`multica skill create --content-stdin` where stdin is a broken/closed pipe, a redirected file that becomes unreadable, or the process was spawned with an invalid stdin descriptor.","commonSituations":"Piping from a process that exits and closes the pipe prematurely (`cat file | head`-style truncation); CI runners that give the CLI no stdin; a closed fd 0 in daemonized contexts.","solutions":["Check the wrapped errno; EPIPE usually means the upstream producer exited early.","Capture content to a temp file and use --content-file instead when the producer is flaky.","For non-interactive automation, prefer --content-file over --content-stdin.","Verify stdin is actually connected: re-run interactively or with `< /dev/null` to see the empty-content error instead."],"exampleFix":"# before: producer may close pipe early\ncurl -s https://x/skill.md | multica skill create --name s --content-stdin\n# after\ncurl -s https://x/skill.md -o /tmp/skill.md && multica skill create --name s --content-file /tmp/skill.md","handlingStrategy":"fallback","validationCode":"# Verify the pipe producer emits data with a good exit code before piping\nproducer > /tmp/skill.$$ || { rm -f /tmp/skill.$$; echo \"producer failed\"; exit 2; }\nmultica skill create --name s --content-file /tmp/skill.$$; rc=$?; rm -f /tmp/skill.$$; exit $rc","typeGuard":null,"tryCatchPattern":"On 'read stdin' errors (typically EPIPE), fall back to materializing the producer's output to a temp file and re-running with --content-file; retry only after the producer is fixed.","preventionTips":["In automation prefer --content-file over --content-stdin.","Ensure the producing command succeeds before piping into multica.","Avoid --content-stdin in contexts without a real stdin (cron, daemons)."],"tags":["go","cli","stdin","io","skills"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}