Repository navigation
An empty config file is not a syntax error - #32
Merged
Merged
Conversation
`aipocket config path` tells you where the config goes. Create that file, paste the
example's comment header into it — or nothing at all — and the tool refused to run:
aipocket: ~/.config/aipocket/config.yaml: somewhere in the file: syntax error
(the text at fault is not reproduced here: no redactor exists yet at
config-load time, and a mis-pasted credential is the likeliest thing to be
wrong)
Exit code 2, on the first thing a new user does, with a message implying they had
pasted a credential somewhere. yaml.v3 signals "no document here" with io.EOF, and
an empty file, a file holding one newline, and a file holding only comments all
produce it.
A missing config was always fine — the tool is usable with environment variables
alone, which is the documented first try. This is the same case one byte later, so
it is treated the same way.
The guard is narrow on purpose: only io.EOF. A malformed document still fails with
its line number, which the existing parse-error tests hold in place — swallowing a
real syntax error here would be worse than the bug being fixed, because the config
is where a typo silently withdraws a provider you thought you had disabled.
Found by running `aipocket providers` against /dev/null while checking something
else.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
aipocket config pathtells you where the config goes. Create that file, paste the example's comment header into it — or leave it empty — and the tool refused to run:Exit code 2, on the first thing a new user does, with a message implying they had pasted a credential somewhere. All three of these produced it:
yaml.v3 signals "no document here" with
io.EOF. A missing config was always fine — the tool is usable with environment variables alone, which is the documented first try — so this is the same case one byte later.The guard is deliberately narrow
Only
io.EOF. A malformed document still fails with its line number:Swallowing a real syntax error here would be worse than the bug being fixed: the config is where a typo silently withdraws a provider you believed you had disabled, which is why
ValidateAgainstandKnownFields(true)exist. The existing parse-error tests hold that in place.The new test covers all four spellings of "says nothing" (empty, newline, comments,
providers: {}) and was watched failing on the first three.Found by running
aipocket providersagainst/dev/nullwhile checking something else.🤖 Generated with Claude Code