{"record":{"id":"b3230b17bf290e1f","repo":"multica-ai/multica","slug":"stdin-content-for-s-is-empty","errorCode":null,"errorMessage":"stdin content for --%s is empty","messagePattern":"stdin content for --(.+?) is empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_issue.go","lineNumber":68,"sourceCode":"\t}\n\tif inline != \"\" {\n\t\tsources++\n\t}\n\tif filePath != \"\" {\n\t\tsources++\n\t}\n\tif sources > 1 {\n\t\treturn \"\", false, fmt.Errorf(\"--%s, --%s, and --%s are mutually exclusive\", flagName, stdinFlag, fileFlag)\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 --%s: %w\", stdinFlag, err)\n\t\t}\n\t\tbody := strings.TrimSuffix(string(data), \"\\n\")\n\t\tif body == \"\" {\n\t\t\treturn \"\", false, fmt.Errorf(\"stdin content for --%s is empty\", stdinFlag)\n\t\t}\n\t\treturn body, true, nil\n\t}\n\tif filePath != \"\" {\n\t\tif err := ensureFileFlagWithinWorkdir(cmd, fileFlag, flagName, filePath); err != nil {\n\t\t\treturn \"\", false, err\n\t\t}\n\t\tdata, err := os.ReadFile(filePath)\n\t\tif err != nil {\n\t\t\treturn \"\", false, fmt.Errorf(\"read file for --%s: %w\", fileFlag, err)\n\t\t}\n\t\tbody := strings.TrimSuffix(string(data), \"\\n\")\n\t\tif body == \"\" {\n\t\t\treturn \"\", false, fmt.Errorf(\"file content for --%s is empty\", fileFlag)\n\t\t}\n\t\treturn body, true, nil\n\t}\n\tif inline == \"\" {","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_issue.go#L50-L86","documentation":"Returned by the shared text-source helper when --flag-stdin is used and stdin reads successfully but contains only whitespace-trimmed-to-empty content (a trailing newline is stripped, then the body is empty). An explicitly empty stdin is treated as a probable mistake rather than an intentional empty value.","triggerScenarios":"Piping an empty string or only newlines into a --*-stdin flag: echo \"\" | multica issue create --description-stdin, or redirecting an empty file, or an upstream command that produced no output while still succeeding.","commonSituations":"Upstream command in a pipeline succeeded but emitted nothing (empty query result, empty variable); empty temp files from earlier failed steps; test fixtures that forgot to populate stdin.","solutions":["Ensure the producer of the piped data actually writes non-empty content; check the upstream command's output independently","If the value can legitimately be empty, omit the stdin flag entirely instead of passing empty stdin","In scripts, guard with a non-empty check before invoking: test -s file || exit 1"],"exampleFix":"# before\nprintf '\\n' | multica issue create --title \"T\" --description-stdin\n# error: stdin content for --description-stdin is empty\n\n# after\nprintf 'Real description\\n' | multica issue create --title \"T\" --description-stdin","handlingStrategy":"validation","validationCode":"# bash: only pipe when the producer emitted content\nbody=\"$(upstream_command)\"\nif [[ -n \"$body\" ]]; then\n    printf '%s\\n' \"$body\" | multica issue create --title \"$t\" --description-stdin\nelse\n    echo \"upstream produced no description\" >&2; exit 1\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Test -s on files (and -n on variables) before feeding them to stdin flags","Treat empty producer output as an upstream failure, not a valid payload"],"tags":["cli","stdin","validation","empty-input"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}