ethereum/go-ethereum · error

%T: invalid node: %v

Error message

%T: invalid node: %v

What it means

Error "%T: invalid node: %v" thrown in ethereum/go-ethereum.

Source

Thrown at trie/proof.go:82

			key = key[1:]
			nodes = append(nodes, n)
		case hashNode:
			// Retrieve the specified node from the underlying node reader.
			// trie.resolveAndTrack is not used since in that function the
			// loaded blob will be tracked, while it's not required here since
			// all loaded nodes won't be linked to trie at all and track nodes
			// may lead to out-of-memory issue.
			blob, err := t.reader.Node(prefix, common.BytesToHash(n))
			if err != nil {
				log.Error("Unhandled trie error in Trie.Prove", "err", err)
				return err
			}
			// The raw-blob format nodes are loaded either from the
			// clean cache or the database, they are all in their own
			// copy and safe to use unsafe decoder.
			tn = mustDecodeNodeUnsafe(n, blob)
		default:
			panic(fmt.Sprintf("%T: invalid node: %v", tn, tn))
		}
	}
	hasher := newHasher(false)
	defer returnHasherToPool(hasher)

	for i, n := range nodes {
		enc := hasher.proofHash(n)
		if len(enc) >= 32 || i == 0 {
			proofDb.Put(crypto.Keccak256(enc), enc)
		}
	}
	return nil
}

// Prove constructs a merkle proof for key. The result contains all encoded nodes
// on the path to the value at key. The value itself is also included in the last
// node and can be retrieved by verifying the proof.
//

View on GitHub (pinned to 6bb0588ad8)

Solutions

  1. This panic indicates trie database corruption or an unexpected node encoding. Re-sync or restore the state database from a known-good snapshot.
  2. Ensure the node data passed to proofHash/mustDecodeNodeUnsafe was loaded intact from the database; check for disk corruption or a partial write.

Example fix

// If the node store is corrupt, remove the ancient/chaindata state and resync:
// geth removedb  (then re-sync from peers or a snapshot)

When it happens

Trigger: Proof generation encountering a trie node that is neither a shortNode, fullNode, hashNode, nor raw blob — typically a sign of corrupted state data.

Common situations: Corrupted chaindata after an unclean shutdown, disk failure, or manual database manipulation.


AI-assisted analysis of ethereum/go-ethereum@6bb0588ad8 (2026-08-15). Data as JSON: /api/errors/d446afcf2bead391. Report an issue: GitHub.