{"record":{"id":"6150cc95f7c0731e","repo":"babysor/MockingBird","slug":"input-text-is-empty","errorCode":null,"errorMessage":"Input text is empty.","messagePattern":"Input text is empty\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"skills/speak/scripts/noiz_tts.py","lineNumber":162,"sourceCode":"    parser.add_argument(\n        \"--duration\",\n        type=float,\n        default=None,\n        metavar=\"SEC\",\n        help=\"Target audio duration in seconds (0, 36], optional\",\n    )\n    parser.add_argument(\"--timeout-sec\", type=int, default=120)\n    args = parser.parse_args()\n    args.api_key = normalize_api_key_base64(args.api_key)\n\n    try:\n        if args.text_file:\n            text = Path(args.text_file).read_text(encoding=\"utf-8\").strip()\n        else:\n            text = args.text\n\n        if not text:\n            raise ValueError(\"Input text is empty.\")\n\n        if len(text) > 5000:\n            print(\n                f\"Warning: text is {len(text)} chars (max 5000). \"\n                \"Consider chunking for long texts.\",\n                file=sys.stderr,\n            )\n\n        if args.auto_emotion:\n            text = call_emotion_enhance(\n                args.base_url, args.api_key, text, args.timeout_sec\n            )\n\n        ref = Path(args.reference_audio) if args.reference_audio else None\n        out_duration = synthesize(\n            base_url=args.base_url,\n            api_key=args.api_key,\n            text=text,","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/babysor/MockingBird/blob/28dc5e14f12d7c754612af2fde8e78a4b03f8616/skills/speak/scripts/noiz_tts.py#L144-L180","documentation":"ValueError raised by main() when the effective input text is empty after reading from --text or --text-file and stripping whitespace. TTS synthesis requires non-empty text.","triggerScenarios":"Passing --text \"\" or whitespace-only string; passing --text-file pointing at an empty file or one containing only whitespace/newlines.","commonSituations":"Empty input file from a previous failed pipeline step, whitespace-only argument from unquoted shell expansion, or wrong file passed via --text-file.","solutions":["Check the file/argument actually contains content before running","Validate upstream producers that generate the text file","Fail fast in shell: [ -s input.txt ] || exit 1"],"exampleFix":"# before\npython noiz_tts.py --text-file empty.txt ...\n# after\n[ -s input.txt ] || { echo \"input empty\"; exit 1; }\npython noiz_tts.py --text-file input.txt ...","handlingStrategy":"validation","validationCode":"text = (Path(args.text_file).read_text(encoding='utf-8') if args.text_file else args.text).strip()\nif not text:\n    sys.exit('Input text is empty.')","typeGuard":null,"tryCatchPattern":"try:\n    main()\nexcept ValueError as e:\n    sys.exit(str(e)) if 'empty' in str(e) else raise_","preventionTips":["[ -s file.txt ] shell guards in pipelines","Validate producer outputs before invoking TTS","Strip and assert non-empty at ingest"],"tags":["validation","input","cli","noiz-tts"],"backgroundTag":"empty-input","analyzedSha":"28dc5e14f12d7c754612af2fde8e78a4b03f8616","analyzedAt":"2026-08-27T02:26:53.589Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}