{"record":{"id":"ddcc08fa54527354","repo":"gastownhall/beads","slug":"empty-description-from-stdin-file-requires-allow","errorCode":null,"errorMessage":"empty description from stdin/file requires --allow-empty-description (or use an explicit inline empty value like --description \"\")","messagePattern":"empty description from stdin/file requires --allow-empty-description \\(or use an explicit inline empty value like --description \"\"\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/update_description_guard.go","lineNumber":47,"sourceCode":"\t\tmessage, _ := cmd.Flags().GetString(\"message\")\n\t\tif message == \"-\" {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\nfunc validateDescriptionUpdate(cmd *cobra.Command, description string, descChanged bool) error {\n\tif !descChanged || description != \"\" || !descriptionUsesExternalInput(cmd) {\n\t\treturn nil\n\t}\n\n\tallowEmptyDescription, _ := cmd.Flags().GetBool(\"allow-empty-description\")\n\tif allowEmptyDescription {\n\t\treturn nil\n\t}\n\n\treturn fmt.Errorf(\"empty description from stdin/file requires --allow-empty-description (or use an explicit inline empty value like --description \\\"\\\")\")\n}\n","sourceCodeStart":29,"sourceCodeEnd":49,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/update_description_guard.go#L29-L49","documentation":"When a description update sources its body from stdin or a file and the resulting text is empty, bd refuses to wipe the description silently. The caller must opt in with --allow-empty-description, or pass an explicit inline empty value, to make the intent unambiguous.","triggerScenarios":"`bd update <id> --description-file empty.md`, `cat x | bd update <id> --stdin`, or `--description -` where the piped file/stream is empty, without --allow-empty-description.","commonSituations":"Empty or mis-pathed body file; a build script piping output that produced nothing; CI env where the file wasn't generated; accidentally redirecting an empty stream intending to clear the description.","solutions":["Verify the stdin/file actually contains the intended text","Add --allow-empty-description if clearing the description is intentional","Or pass an explicit inline empty value: --description \"\""],"exampleFix":"// before\nbd update bd-42 --description-file notes.md   # notes.md is empty\n// after\nbd update bd-42 --description-file notes.md --allow-empty-description","handlingStrategy":"validation","validationCode":"if descChanged && description == \"\" && usesStdinOrFile(cmd) && !allowEmpty {\n    return errors.New(\"refusing empty description from stdin/file; pass --allow-empty-description to confirm\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check that stdin/file input is non-empty before piping","Pass --allow-empty-description only when clearing is intentional","Prefer explicit inline --description \"\" to signal deliberate clearing"],"tags":["cli","validation","description"],"backgroundTag":"empty-input-rejected","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}