Skip to content

ImageDescriber exits 0 on every failure (Ollama unreachable, missing import file, missing required option, failed images) #167

Description

@matt-edmondson

What's wrong

In ImageDescriber/Program.cs (~lines 22–28), Main returns void, and Parser.Default.ParseArguments(...).WithParsed(...) ignores parse errors. Each verb's Run reports a failure with Console.WriteLine and then returns normally.

Reproduced, and each of these exits with 0:

Command Output Exit code
Scan -p <dir> -e http://127.0.0.1:1 "Error: Ollama is not available" 0
Import -i /nonexistent.csv "File not found" 0
Search without -q "Required option 'q, query' is missing" 0
A Scan where some images fail (the failure summary from #155) lists the failures 0

Why it matters

A script, CI job or scheduled task that runs ImageDescriber Scan cannot tell that nothing, or only part of the folder, was described. OAICLI recently fixed the same problem in commit 5ecfd8e ("exit non-zero when the OpenAI API rejects a request").

Suggested fix

  • Make Main return int, and map WithNotParsed to 1.
  • Have BaseVerb.Run return a status (or set Environment.ExitCode) so that failures are non-zero: Ollama unavailable, missing or wrong input file, unwritable output, and a non-empty scan failure list.

Acceptance criteria

  • Each command in the table above exits non-zero.
  • Successful runs still exit 0.
  • A test asserts the exit status for at least the parse-error and Ollama-unavailable cases.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreadyFully specified; implement as written

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions