Minimal Explanatory Stack Subtrace with Boundaries
MESS-B filters Nix evaluator stack traces to their causal essence while preserving semantic boundaries between user code and library internals.
Nix error traces are nightmares. A simple "package imported as module" error produces 55 frames spanning 19KB, of which 2 contain actionable information and 0 appear in user code.
$ nix build 2>&1 | mess-b
error[E-INFINITE-RECURSION]: infinite recursion encountered
--> /nix/store/.../nixos/common.nix:109:20
| [boundary: module-system → user-code]
--> .../lib/modules.nix:508:28
| while evaluating the module argument 'stdenv'
hint: a package derivation may have been imported as a module
(6/55 frames shown, 89% reduction)
# With cabal
cabal install mess-b
# With nix
nix profile install github:weyl-ai/mess-b# Pipe from nix
nix build 2>&1 | mess-b
# From file
mess-b -i error.log
# Adjust frame limit
mess-b -n 5
# Verbose output
mess-b --verboseimport MessB
main :: IO ()
main = do
rawTrace <- getContents
case parseAndFilter rawTrace of
Left errorMessage -> putStrLn $ "Parse error: " <> errorMessage
Right filtered -> putStrLn $ renderCompact filtered- Parse - Extract structured frames from raw Nix output
- Classify - Categorize each frame (UserCode, ModuleSystem, LibraryInternal, etc.)
- Detect Boundaries - Find transitions between code regions (where blame transfers)
- Filter - Retain high-value frames, boundaries, and user code
- Hint - Generate diagnostic hints from known error patterns
- Render - Format output with boundary annotations and statistics
Three-tier fallback:
- Explicit role - Frame has annotation (HighConfidence)
- Ontology lookup - Function name in known-functions table (HighConfidence)
- Path heuristics - File path patterns (MediumConfidence)
Key invariant: User code is never misclassified as library internal.
Boundaries mark transitions between code regions:
module-system → user-code- Blame transfers to userlibrary → user-code- External code enters user spaceoverlay → package-set- Overlay composition point
| Pattern | Hint |
|---|---|
InfiniteRecursion + stdenv in module context |
Package imported as module |
InfiniteRecursion + fix + extends |
Overlay recursion |
AttributeMissing + callPackage |
Missing dependency |
# Build
cabal build
# Test
cabal test
# Run property tests
cabal test --test-option=--hedgehog-tests=10000MIT
Weyl AI - weyl.ai