Skip to content

feat: clearer fatal error messages for missing API keys and images#5

Merged
rasros merged 1 commit into
mainfrom
feat/better-error-messages
Jul 10, 2026
Merged

feat: clearer fatal error messages for missing API keys and images#5
rasros merged 1 commit into
mainfrom
feat/better-error-messages

Conversation

@rasros

@rasros rasros commented Jul 10, 2026

Copy link
Copy Markdown
Owner

What

Improves the top-level failure messages in main.py so users get an actionable line instead of a terse or leaky one, and standardizes the prefix.

API keys — the auto path previously printed just CRITICAL: No API key found. with no hint about what to set. It now names all three env vars:

Error: no LLM API key found. Set one of OPENAI_API_KEY, ANTHROPIC_API_KEY, or GEMINI_API_KEY in your environment.

The explicit-provider path names the specific missing var and the fix:

Error: --provider anthropic was selected but ANTHROPIC_API_KEY is not set. Export ANTHROPIC_API_KEY or pick a provider whose key is set.

Missing image — the generic handler used to print the raw OS error (FATAL: [Errno 2] No such file or directory: 'x.png'). A dedicated FileNotFoundError handler now prints a clean line:

Error: input image not found: x.png

Prefix — standardized CRITICAL: / FATAL: to a single Error: prefix, matching the Error: ... voice already used by the argparse validation in cli.py.

Notes

The image ordering fix (validating before the output directory tree is created) is the follow-up task and lands in a separate PR; this one is message-quality only.

Tests

New test_main.py covers the no-key and missing-key error paths (message names the vars, exit code 1, Error: prefix) plus provider-priority and explicit-model resolution. Full suite: 361 passed.

@rasros rasros merged commit 3167ac6 into main Jul 10, 2026
1 check passed
@rasros rasros deleted the feat/better-error-messages branch July 10, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant