ethereum/go-ethereum · error
sub-trie ancestor not found: %x
Error message
sub-trie ancestor not found: %x
What it means
Error "sub-trie ancestor not found: %x" thrown in ethereum/go-ethereum.
Source
Thrown at trie/sync.go:312
exist, inconsistent := s.hasNode(owner, inner, root)
if exist {
// The entire subtrie is already present in the database.
return
} else if inconsistent {
// There is a pre-existing node with the wrong hash in DB, remove it.
s.membatch.delNode(owner, inner)
}
// Assemble the new sub-trie sync request
req := &nodeRequest{
hash: root,
path: path,
callback: callback,
}
// If this sub-trie has a designated parent, link them together
if parent != (common.Hash{}) {
ancestor := s.nodeReqs[string(parentPath)]
if ancestor == nil {
panic(fmt.Sprintf("sub-trie ancestor not found: %x", parent))
}
ancestor.deps++
req.parent = ancestor
}
s.scheduleNodeRequest(req)
}
// AddCodeEntry schedules the direct retrieval of a contract code that should not
// be interpreted as a trie node, but rather accepted and stored into the database
// as is.
func (s *Sync) AddCodeEntry(hash common.Hash, path []byte, parent common.Hash, parentPath []byte) {
// Short circuit if the entry is empty or already known
if hash == types.EmptyCodeHash {
return
}
if s.membatch.hasCode(hash) {
return
}View on GitHub (pinned to 6bb0588ad8)
Solutions
- The scheduled sub-trie request references a parent that was never registered. Ensure parent sub-trie paths are scheduled before (or together with) their children in trie.Sync, and that path prefixes are consistent.
- Treat this as an internal sync-scheduling bug: check that the caller derives sub-trie parent paths correctly.
Example fix
// Parent sub-trie must be scheduled first: sync := trie.NewSync(root, db, callback, scheme) sync.AddSubTrie(parentPath, parentPathHash, parentRoot, nil) sync.AddSubTrie(childPath, childHash, childRoot, parentRoot) // parent known
When it happens
Trigger: trie.Sync scheduling a sub-trie request whose designated parent hash was not previously scheduled as a node request.
Common situations: Snap sync healing or state sync code scheduling child sub-tries before their ancestors.
AI-assisted analysis of ethereum/go-ethereum@6bb0588ad8 (2026-08-15).
Data as JSON: /api/errors/4c5772f5ef79596a.
Report an issue: GitHub.