Repository navigation
fix(cache): print the full cause chain in CacheError Display - #2276
Merged
Merged
Conversation
CacheError::Store, Internal, and OriginError render their anyhow cause with the alternate format, so error = %e log sites keep the underlying iroh-blobs / origin causes. #[source] stays, so source()/chain() walks are unchanged. Closes #2269 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Code Coverage OverviewLanguages: Rust, Solidity Rust / code-coverage/cargo-llvm-covThe overall line coverage in commit 4112865 in the Show a line coverage summary of the most impacted files.
Solidity / code-coverage/forgeThe overall line coverage in commit 4112865 in the Updated |
Store, Internal, and OriginError render the whole cause chain in Display,
so they no longer expose it through source() as well. A {:#} or {:?} on
an anyhow chain that wraps a CacheError (the own-origin pull leg logs
this way) printed every inner cause twice. OriginError's field and
DecompressionFailed's field become `cause`, because thiserror treats a
field named `source` as the error source. DecompressionFailed renders
its decoder error and drops source() for the same reason.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…h display_chain
Removing source() from CacheError's cause-carrying variants hid every
cause below a CacheError from .chain() walkers. The client's fault
classifier then missed a full local disk under a CacheError::Store, so
a node pull blamed and paid each holder in turn instead of ending.
Store, Internal, OriginError and OriginError::DecompressionFailed now
name only themselves in Display and return the cause from source(), so
chain walkers see it and chain formatters name each cause once. The new
CacheError::display_chain / ErrorChain render the whole chain on one
line; every log site and operator message that printed a bare
CacheError uses it. Flattened anyhow!("..{e}") wrappers become
.context() so the chain survives. PrefixedBodyError continues its
source() from the original error's own source instead of repeating it.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The origin-advance log printed an OriginPullError with to_string(), so a
decompression failure lost the decoder reason now that
DecompressionFailed names only itself. It and the other origin-pull log
sites (enumerate, origin-probe HEAD, size probe, retry exhausted,
transient retry) render with {:#}, which OriginPullError's transparent
Display passes through to the anyhow chain.
The S3 nested-cause test uses a payload whose cause is outside its
Display, so it fails when PrefixedBodyError::source() drops the chain.
The admin RPC message gains a test pinning its cause chain, and the
ErrorChain and cache_error_to_rpc docs describe what they render.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Gas snapshotNo gas changes vs base. |
alpergundogdu
approved these changes
Oct 3, 2026
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.
Summary
CacheErrorwitherror = %eshowed only the top message and dropped the iroh-blobs / origin causes.CacheError::Store,Internal,OriginErrorandOriginError::DecompressionFailedname only themselves inDisplayand return their cause fromsource(). Each cause appears exactly once in a chain render. (main also printed the outermost context twice under{:#}.).chain()walkers see every cause under aCacheError.CacheError::display_chain()/decdn_cache::ErrorChainrendersstore error: context: root causeon one line. Every log site and operator message that printed a bareCacheErroruses it (list below).anyhow!("… {e}")/anyhow::Error::msg(format!("…{other}"))wrappers become.context(), so the typed chain survives (delivery.rs×2,engine.rs×2).PrefixedBodyErrorkeepss3://bucket/key: <original>inDisplay. Itssource()continues from the original error's own source, so the original is not printed twice.Why
source()and not chain-in-DisplayAn earlier revision of this PR put the chain in
Displayand removedsource(). That brokedecdn_client::classify. It walks.chain()for a local-diskio::Error(StorageFull,ReadOnlyFilesystem, …), and that error sits below aCacheError::Storeon the node's pull path (admit_store.rs→ client driver →pull_leg.rsends_the_assembly). With the walk stopped at theCacheError, a full disk classified asFault::Source, and the node paid and blamed each holder in turn. No test caught it. The new regression test pins it.Sites switched to
display_chain()/ErrorChain/{:#}engine.rs: gc snapshot, observe-partial, open store walk, admit coverage, evict tag drop, quarantine tag drop, outboard fetch, own-origin range open,record_origin_pullspanerrorfield.origin_range.rs:failmessage, window fetch log.admin.rs:cache_error_to_rpc(thedecdn node evict/ inspect message).handlers/client/dispatch.rs: serve_audit, own-origin range probe ({e:#}on a bareCacheErrorignored the#flag), size probe, inspect.handlers/client/fill.rs: all 8 pull-through logs.handlers/client/delivery.rs: mid-delivery export fault log.handlers/client/window.rs: missing / held ranges, outboard seed.handlers/probe.rs: 4 sites.dht/publish.rs: 3 sites.runtime/mod.rsandruntime/eviction.rs: 3 sites.node_origin/backend_source.rs: fault message.node_origin/mod.rs:UnreachableandOurLocalFaultverdict logs ({err:#}).OriginPullError/ anyhow origin faults ({:#}, which the transparentOriginPullErrorpasses through):engine.rsorigin-advance log (a decompression failure kept only "failed to decompress gzip response body"),enumerate, origin-probe HEAD and size-probe logs;retry.rsretry-exhausted and transient-retry logs.Chain walkers that can reach a
CacheError(audited)client/fault.rsis_local_disk_fault: works again (the bug above).pull_leg.rsis_internal_fault/is_bao_corruption: work. TheCacheErroritself is a chain link.error.rsorigin_error_kind: works (walks its ownsource).pull_verdict, serve-sideis_peer_attributable/ErrEnd/PaidProgress/ frame metering: these use anyhowis/downcast_ref, which never followssource(), so they are unchanged. The newdelivery.rs.contextwrapping adds no marker.Test plan
a_full_disk_under_a_store_fault_ends_the_assembly(node): aCacheError::Storewrappingiroh_blobs::api::Error::io(StorageFull, ..), both directly inanyhowand throughRangedStoreError::Backend.classifygivesFatal(Command)(the verdictLocalPullFaultgets) and the assembly ends. It failed on the previous head (Source).error.rs: shortDisplay,source()is the cause,display_chainrenders exactlyvariant: ctx: root,{:#}/{:?}name each cause once (unique tokens, so backtraces can't collide),origin_error_kindfindsDecompressionFailedthrough a context layer.s3.rs: a prefixed body error renders the original once; a payload whose cause sits outside itsDisplaykeeps that cause on the chain (fails ifsource()drops it).admin.rs:cache_error_rpc_message_carries_the_cause_chainpins thedecdn node evictmessage tostore error: <ctx>: <root>.pull_through.rs,held_corruption.rs,delivery.rsassertions render through the chain helper.cargo nextest run -p decdn-cache(495),-p decdn-node --lib(1171),-p decdn-client --lib(506)cargo clippy --workspace --all-targets -- -D warnings,cargo fmt -- --check,cargo docwith-D warningsFollow-ups (pre-existing, out of scope): #2286
Closes #2269
🤖 Generated with Claude Code