From 87d20aeefac1f5333d4c0ccdab6b36a9e45ca160 Mon Sep 17 00:00:00 2001 From: Chen Cheng <85005591+ischencheng@users.noreply.github.com> Date: Tue, 6 Oct 2026 14:16:14 -0400 Subject: [PATCH] Check the prompt or conditioning file before planning a generation generate copied --prompt-file and --conditioning only after GPU detection, planning and creating .artifacts. A mistyped, missing or empty input failed there and left that directory behind, so every retry with the same --out stopped at FileExistsError until the directory was deleted by hand. Read the prompt (UTF-8, nonempty) or check the conditioning file right after argument parsing instead, before anything is created. --- freevideo_engine/cli.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/freevideo_engine/cli.py b/freevideo_engine/cli.py index ce45838..222971a 100644 --- a/freevideo_engine/cli.py +++ b/freevideo_engine/cli.py @@ -121,6 +121,15 @@ def main(): help='Measure the placement questions this machine can settle') calibrate.add_argument('arguments', nargs=argparse.REMAINDER) args = parser.parse_args() + if args.command == 'generate': + # Check the input before detection and planning. A mistyped or empty prompt + # file failed only after .artifacts was created, and every retry with + # the same --out then stopped at FileExistsError. + if args.prompt_file: + if not args.prompt_file.read_text(encoding='utf-8').strip(): + raise ValueError('A nonempty prompt is required') + elif not args.conditioning.is_file(): + raise FileNotFoundError(f'Conditioning file not found: {args.conditioning}') if sys.platform == 'darwin' and args.command in ('plan', 'generate', 'encode', 'doctor'): from .macos_generate import dispatch return dispatch(args)