ethereum/go-ethereum · error

it shouldn't happen

Error message

it shouldn't happen

What it means

Error "it shouldn't happen" thrown in ethereum/go-ethereum.

Source

Thrown at trie/proof.go:411

				// path(it doesn't belong to the range), keep
				// it with the cached hash available.
				//}
			}
			return nil
		}
		if _, ok := cld.Val.(valueNode); ok {
			fn := parent.(*fullNode)
			fn.Children[key[pos-1]] = nil
			return nil
		}
		cld.flags = nodeFlag{dirty: true}
		return unset(cld, cld.Val, key, pos+len(cld.Key), removeLeft)
	case nil:
		// If the node is nil, then it's a child of the fork point
		// fullnode(it's a non-existent branch).
		return nil
	default:
		panic("it shouldn't happen") // hashNode, valueNode
	}
}

// hasRightElement returns the indicator whether there exists more elements
// on the right side of the given path. The given path can point to an existent
// key or a non-existent one. This function has the assumption that the whole
// path should already be resolved.
func hasRightElement(node node, key []byte) bool {
	pos, key := 0, keybytesToHex(key)
	for node != nil {
		switch rn := node.(type) {
		case *fullNode:
			for i := key[pos] + 1; i < 16; i++ {
				if rn.Children[i] != nil {
					return true
				}
			}
			node, pos = rn.Children[key[pos]], pos+1

View on GitHub (pinned to 6bb0588ad8)

Solutions

  1. This is a defensive unreachable-code panic in the proof unset path; hitting it means an unexpected node type (hashNode/valueNode) was passed where only full/short nodes are valid. Investigate the trie data for corruption and re-sync if needed.

Example fix

// No user-side fix: this panic guards an internal invariant.
// If hit, the trie is corrupt — rebuild state via re-sync or snapshot restore.

When it happens

Trigger: Internal proof-path manipulation (unset) receiving a node type that should have been resolved earlier.

Common situations: Only reachable through corrupted trie structures or a bug in proof handling code.


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