Always show full config parse errors with full details in output#2149
Merged
Conversation
The root cause is that the error was formatted with `{}` (Display),
which for `anyhow` only shows the outermost message in the error chain.
Since
d5d22bc
restructured the error handling to use `e.context(msg)`, which wraps the
TOML details *under* the context message, the Display format only shows
the context message and loses the TOML parse error details (line number,
column, offending value, etc.).
Changing `{}` to `{:?}` uses `anyhow`'s Debug format, which prints the
full error chain:
Fixes #2146
katrinafyi
approved these changes
Apr 17, 2026
katrinafyi
left a comment
Member
There was a problem hiding this comment.
It's a quick and easy fix, awesome!
I was curious and this is what the error looks like for package.json after this change.
[ERROR] Error while loading config: Cannot load configuration file: package.json
Caused by:
0: Failed to parse lychee config from package.json
1: invalid type: string "a", expected a nonzero usize at line 3 column 18
See: https://github.com/lycheeverse/lychee/blob/lychee-v0.23.0/lychee.example.toml
Member
Author
|
That looks really good! |
Member
Author
|
Thanks for the review and the check. 😀 |
Merged
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.
The root cause is that the error was formatted with
{}(Display), which foranyhowonly shows the outermost message in the error chain.Since d5d22bc restructured the error handling to use
e.context(msg), which wraps the TOML details under the context message, the Display format only shows the context message and loses the TOML parse error details (line number, column, offending value, etc.).Changing
{}to{:?}usesanyhow's Debug format, which prints the full error chain:Fixes #2146