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

  1. matt-edmondson commented on Sep 28, 2026

    @matt-edmondson
    ContributorAuthor

    Triage

    • Category: Bug
    • Priority: Medium. A script or CI job can't detect failures, including a complete Ollama outage. Interactive users still see the error text, and no data is lost.
    • Area / suggested assignment: CLI entry point (Program.Main) and BaseVerb.Run return contract
    • Duplicates: none. OAICLI fixed the same pattern in 5ecfd8e, and FileDeduplicator#144 reports the same problem in another repo, so the fix pattern can be shared.
    • In progress: no matching open PR. Bump the ktsu group with 5 updates #159 is a dependency bump only.

    Notes: Pair this with #165. Once Main returns int, the non-Windows menu fallback there can also exit non-zero cleanly.


    Generated by Claude Code

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

Metadata

Metadata

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