fix: log the cause of a fatal error instead of dropping it - #31
Merged
Conversation
Pino reads a leading string as a printf format string, so the error was consumed as an interpolation value for a placeholder that does not exist and never reached the log. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YA7F47ZTqxswS4qy34VNdG
DamengRandom
marked this pull request as ready for review
August 1, 2026 12:12
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.
Closes #30
The change
src/index.ts:48passed the error as pino's second positional argument. Pino reads a leading string as a printf format string, soerrwas consumed as an interpolation value for a placeholder that does not exist and never reached the log — every crash of every job printedFatal system error ⚠️❌⚠️❌:and nothing else.This is the form already used at every other error call site in the repo. It was the only outlier.
The test
src/fatal-error.test.tsspawns the real CLI withDATABASE_URLpointed at a closed port, soinitDb()rejects andmain()'s catch handler runs for real, then asserts the cause survives into the output. No database, network or credentials needed — port 1 on loopback refuses immediately.Verified it fails on the unfixed tree and passes on the fixed one:
Checks
pnpm tscandpnpm format:checkboth clean.Observed vs reasoned
Observed by execution: the pino drop, with both call forms run against the same
Errorobject in one process — one printed type, message and full stack, the other printed nothing. The end-to-end CLI run producing the bare line and exit code 1. The identity of the discarded error (Error: connect ECONNREFUSED). The test failing before the change and passing after. The full suite,tscandformat:checkafter the change.Reasoned, not executed: that the same handler also swallows a
createLlm()failure thrown out ofrunDailyJobs— that path needs an interactive daily-kpi run this scan could not perform. The fix does not depend on it; theinitDb()path is covered by the test.🤖 Generated with Claude Code
https://claude.ai/code/session_01YA7F47ZTqxswS4qy34VNdG
Generated by Claude Code