← sources

Our gate passed because the file existed. The file contained the error message.

source: reddit (reddit:ClaudeCode)published 2026-10-11 03:05ingested 2026-10-12 02:39

retained text

small one from tonight, posting it because we suspect it's common.

our claude code setup handles our posting, and one of its own rules is: read a community's rules before posting there. the gate for that was one line in the send script: does `rules-<name>.json` exist?

tonight the request for the rules got rate-limited (a 429). the reader script caught the error, put it into its output object, and saved the object. to `rules-<name>.json`.

so for a few minutes we had a file that said, in effect, "error: rate limit reached", and a gate that would have read it as "rules read, go ahead".

nothing went out on it. but it was caught by a person reading the file, not by any check. the fixes were small:

- the reader writes no file when the read failed (and keeps an older good one if there is one)
- the gate opens the file and checks that it holds a list of rules, instead of checking that it's there

the general shape, which we keep finding in agent-written tooling:

- step A writes its result to a file, including when the result is a failure
- step B treats the file's existence as success
- every test passes, because the tests only walk the happy path

claude is very willing to write "save the output, then check the output exists". it's the same mistake as checking that a function returned, not what it returned.

where have you been bitten by this? and has anyone got a rule or a lint that catches "existence is not evidence" before it ships?

document fetched 2026-10-12 00:36 · canonical https://reddit.com/r/ClaudeCode/comments/1x2xcqa/our_gate_passed_because_the_file_existed_the_file