{"record":{"id":"c592a99139698cb3","repo":"ethereum/go-ethereum","slug":"t-invalid-node-v","errorCode":null,"errorMessage":"%T: invalid node: %v","messagePattern":"%T: invalid node: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"trie/inspect.go","lineNumber":495,"sourceCode":"\t\t\towner := common.BytesToHash(hexToCompact(path))\n\t\t\tstorage, err := New(StorageTrieID(in.root, owner, account.Root), in.triedb)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(\"Failed to open account storage trie\", \"node\", n, \"error\", err, \"height\", height, \"path\", common.Bytes2Hex(path))\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tstorageStat := NewLevelStats()\n\t\t\trun := func() {\n\t\t\t\tin.recordRootSize(storage, account.Root, storageStat)\n\t\t\t\tin.inspect(storage, storage.root, 0, []byte{}, storageStat)\n\t\t\t\tin.writeDumpRecord(owner, storageStat)\n\t\t\t}\n\t\t\tif in.trySpawn(&wg, run) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\trun()\n\t\t}\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"%T: invalid node: %v\", n, n))\n\t}\n\n\t// Wait for all goroutines spawned at this level before recording\n\t// the current node. This ensures the entire subtree is counted\n\t// before this call returns.\n\twg.Wait()\n\n\t// Record stats for current height.\n\tstat.add(n, height)\n}\n\n// Summarize performs pass 2 over a trie dump and reports account stats,\n// aggregate storage statistics, and top-N rankings.\nfunc Summarize(dumpPath string, config *InspectConfig) error {\n\tconfig = normalizeInspectConfig(config)\n\tif dumpPath == \"\" {\n\t\tdumpPath = config.DumpPath\n\t}","sourceCodeStart":477,"sourceCodeEnd":513,"githubUrl":"https://github.com/ethereum/go-ethereum/blob/6bb0588ad8e7f922e4ad5580f51265a4097af08f/trie/inspect.go#L477-L513","documentation":"The trie inspector (trie/inspect.go) panics when it encounters a node type it does not know how to traverse (the default branch of its per-node-type switch). The inspector walks accounts and storage tries by concrete node type (shortNode, fullNode, valueNode, hashNode); any other type means the structure is invalid for inspection.","triggerScenarios":"Running trie dump/inspect APIs over a trie containing unexpected node implementations; corrupted trie data loaded from a damaged database; custom node types injected by forked trie code.","commonSituations":"Running chain data inspection tools (trie dump, state size accounting) against a corrupted or partially-written datadir; mixing trie package versions after an incomplete upgrade; inspecting tries built by modified node software.","solutions":["Verify the database is intact (e.g. run the node's integrity/verification tools) before inspecting.","Re-sync the chain data if corruption is confirmed.","If running custom trie code, make sure every node type you introduce is handled by the inspector's switch.","Capture the panic stack and the offending node type (%T) to identify which subtree is malformed."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"defer func() {\n    if r := recover(); r != nil {\n        return fmt.Errorf(\"trie inspection aborted on invalid node: %v\", r)\n    }\n}()\nerr := inspector.Run()","preventionTips":["Validate database integrity before running inspection/dump tooling.","Keep the node stopped (no concurrent writes) while inspecting state.","Log the node type from the panic to pinpoint the malformed subtree."],"tags":["trie","inspection","invariant-violation","corruption","panic","go"],"backgroundTag":null,"analyzedSha":"6bb0588ad8e7f922e4ad5580f51265a4097af08f","analyzedAt":"2026-08-15T10:06:53.996Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}