--dockerfile with a missing file or a folder prints a raw [Errno 2] / [Errno 21] error
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 85/100
Research direction
Start with read_image() in src/wheelgap/cli.py, which calls read_dockerfile() in src/wheelgap/dockerfile.py and currently lets the raw OSError escape. Add an is_file()/exists() check before the read that raises DockerfileError with the message naming the flag and, for a folder, suggesting docker/Dockerfile. Tests go in tests/test_cli.py: a missing path and a folder should each exit 2, and the --json error keys (message, type) should stay the same. Done when those tests fail on main and pass with the change, and the CHANGELOG.md Unreleased bullet is added.
Written by the indexing model from the issue text.
Description
A missing input file gets a plain message (nope.txt: no such file), but a --dockerfile path that doesn't exist, or is a folder, prints Python's raw OSError:
Reproduced with the released uvx wheelgap==0.14.0 (same code on main):
$ uvx wheelgap==0.14.0 nope.txt -p 3.13 -t linux-x86_64
wheelgap: error: nope.txt: no such file
$ uvx wheelgap==0.14.0 --dockerfile nope
wheelgap: error: [Errno 2] No such file or directory: 'nope'
$ mkdir docker && uvx wheelgap==0.14.0 --dockerfile docker
wheelgap: error: [Errno 21] Is a directory: 'docker'
$ uvx wheelgap==0.14.0 --dockerfile nope --json
{"error": {"message": "[Errno 2] No such file or directory: 'nope'", "type": "FileNotFoundError"}}
The message doesn't name the flag, and for a folder it doesn't suggest the likely fix (--dockerfile docker/Dockerfile).
Where
read_dockerfile() in src/wheelgap/dockerfile.py reads the file with path.read_bytes() and only catches UnicodeDecodeError. read_image() in src/wheelgap/cli.py calls it. The MCP tool check_dockerfile (src/wheelgap/mcp.py) and suggest_targets.py call it too, so check that whatever you change still reads well there.
What to do
- Raise
DockerfileErrorfor a path that doesn't exist (--dockerfile nope: no such file) and for a folder (--dockerfile docker: is a folder; pass the Dockerfile in it, e.g. docker/Dockerfile). Simplest: check incli.pybeforeread_dockerfile(), as--dockerfile-contextalready does withis_dir(). - Other
OSErrors (a permission error) can stay as they are.
Done when
- Tests in
tests/test_cli.py: a missing path and a folder each exit 2 with the new message, and with--jsonthe error object has the same keys (message,type). They fail onmain. - No network in the tests.
- One
CHANGELOG.mdbullet under## Unreleased. -
--jsonkeys are only added, never renamed or removed.
- Dominant language
- Python
- Stars
- 0
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from patrickballard/wheelgap
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
patrickballard/wheelgap#728 ·
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
patrickballard/wheelgap#726 ·
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
patrickballard/wheelgap#725 ·
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
patrickballard/wheelgap#724 ·
-
--glibc 2 and --musl 1 are read as 2.0 and 1.0, so every compiled Linux package shows as sourceOpenbug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
patrickballard/wheelgap#723 ·
All issues in patrickballard/wheelgap
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
vllm-project/vllm#69791 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
BCStudentSoftwareDevTeam/cas#481 ·
Maintainers usually reply within 7 days
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
Maintainers usually reply within 1 day