Robust input validation and error handling for job initialization and preflight checks in an AI presenter video creation workflow.
Raw Developer Origin & Technical Request
GitHub Issue
Aug 26, 2026
## Summary
`scripts/init_job.py` crashes with `NotADirectoryError` when `--job-dir` points at an existing file. `scripts/preflight.py` crashes with `TypeError` when `input.supporting_media` is `null` in the job manifest.
Both are triggered by valid edge-case inputs and produce unhandled exceptions instead of the controlled error messages the scripts otherwise provide.
## Reproduction
### Bug 1: `--job-dir` pointing at a file
```bash
touch /tmp/test-file
python3 scripts/init_job.py --job-dir /tmp/test-file --presenter-image README.md --topic test
```
**Expected:** Controlled error (e.g. `"job directory path exists and is not a directory"`).
**Actual:**
```
NotADirectoryError: [Errno 20] Not a directory: /tmp/test-file
```
**Root cause:** `main()` calls `job_dir.iterdir()` before checking `job_dir.is_dir()`.
### Bug 2: `supporting_media: null` in job manifest
Create a `job.json` where `input.supporting_media` is `null` (no key or explicit `null`), then run:
```bash
python3 scripts/preflight.py job.json
```
**Expected:** `ok: true`, empty supporting media list.
**Actual:**
```
TypeError: NoneType object is not iterable
```
**Root cause:** `input_data.get("supporting_media", [])` returns `None` when the key exists with value `null`; the default is only used when the key is absent.
## Proposed fix
1. **`scripts/init_job.py`**: Add `is_dir()` guard before `iterdir()`.
2. **`scripts/preflight.py`**: Normalize `supporting_media` (handle `None`, `""`, scalar string, no...
Developer Debate & Comments
No active discussions extracted for this entry yet.
Frequently Asked Questions
Market intelligence mapped to Robust input validation and error handling for job initialization and preflight checks in an AI presenter video creation workflow..
What problem does Robust input validation and error handling for job initialization and preflight checks in an AI presenter video creation workflow. solve?
What architecture is tied to Robust input validation and error handling for job initialization and preflight checks in an AI presenter video creation workflow.?
Engagement Signals
Cross-Market Term Frequency
Quantifies the cross-market adoption of foundational terms like topic and TypeError by tracking occurrence frequency across active SaaS architectures and enterprise developer debates.
SaaS Metrics