A missing model tag is never caught: pull and check leak a json exception, remove exits 0
parse_options() has a guard for this, and it can never fire:
if (command == "run" || command == "pull" || command == "remove" || command == "check") {
if (parsed_args.model_tag.empty()) { /* Error: Model tag is required */ }
}
program_args_t::model_tag is initialised to "model-faker" and the hidden positional has no default, so an omitted tag is never empty. main.cpp then skips its own lookup for exactly that value (model_tag != "model-faker" && !is_model_supported(...)), so nothing downstream catches it either.
Measured
v0.1.0 dev, commit 743bc39. Four commands, four different wrong behaviours:
| command | what happens | exit |
|---|---|---|
oflm pull |
[ERROR] Exception during download: [json.exception.invalid_iterator.207] cannot use key() for non-object iterators |
1 |
oflm check |
Error: [json.exception.invalid_iterator.207] cannot use key() for non-object iterators |
1 |
oflm remove |
Model not found: model-faker twice, then dumps the whole model list as [ERROR] lines — and exits 0 |
0 |
oflm run |
a correct, clear refusal | 1 |
run is the one path that behaves, and it does so on its own rather than through the dead guard.
Expected
All four print Model tag is required for command '<cmd>' and exit non-zero. Nothing should reach the downloader or the model list with the placeholder tag.
Note for whoever fixes it
.empty() is not the test. "model-faker" is the sentinel, and serve uses it deliberately as its no-tag default, so it cannot simply be removed — compare against the sentinel as well as the empty string.
bench-embed does exactly this in parse_options if you want the shape:
if (parsed_args.command == "bench-embed" &&
(parsed_args.model_tag.empty() || parsed_args.model_tag == "model-faker")) { ... }
oflm remove exiting 0 is the part worth fixing first: a script cannot tell that it did nothing.