unionlabs/union · critical
expected validator, not found
Error message
expected validator, not found
What it means
Export iterates the validators-by-power index (reverse prefix iterator over ValidatorsKey) and re-fetches each validator via GetValidator. If the index yields an address whose validator record cannot be read back, the staking store is internally inconsistent and export panics — a defensive check copied from simapp ExportGenesis. On healthy state the two keys cannot disagree.
Source
Thrown at uniond/app/export.go:207
panic(err)
}
return false
})
if err != nil {
panic(err)
}
// Iterate through validators by power descending, reset bond heights, and
// update bond intra-tx counters.
store := ctx.KVStore(app.GetKey(stakingtypes.StoreKey))
iter := storetypes.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey)
counter := int16(0)
for ; iter.Valid(); iter.Next() {
addr := sdk.ValAddress(stakingtypes.AddressFromValidatorsKey(iter.Key()))
validator, err := app.StakingKeeper.GetValidator(ctx, addr)
if err != nil {
panic("expected validator, not found")
}
validator.UnbondingHeight = 0
if applyAllowedAddrs && !allowedAddrsMap[addr.String()] {
validator.Jailed = true
}
if err := app.StakingKeeper.SetValidator(ctx, validator); err != nil {
panic(err)
}
counter++
}
if err := iter.Close(); err != nil {
app.Logger().Error("error while closing the key-value store reverse prefix iterator: ", err)
return
}
View on GitHub (pinned to 031785bb6d)
Solutions
- Restore the node home from a known-good snapshot or synced copy and re-run export
- Confirm binary/store compatibility — start the intended uniond version so migrations apply before exporting
- If persistent, dump the staking store and diff validators-by-power keys against main validator records to identify the orphaned entry
- If state cannot be reconciled, re-sync the chain rather than exporting corrupted genesis
Defensive patterns
Strategy: validation
Validate before calling
# Never export from the live home dir; run against a snapshot copy uniond export --home /backup/union-copy --for-zero-height > genesis.json 2> export.err || cat export.err
Prevention
- Take periodic data-dir snapshots so export always runs on a verified copy
- Never point a new uniond binary at an old store version without the proper migration path
- Investigate app-hash mismatches immediately — they precede detectable state divergence
- Keep the uniond version that matches your data dir recorded alongside backups
When it happens
Trigger: Corrupted IAVL/multi-store where the power index and the validators key set diverge; a data directory from an incompatible store version or an interrupted migration; a node home tampered with or hit by disk-level corruption.
Common situations: Swapping uniond binaries across store versions without running migrations, hardware/disk corruption, copying a data dir mid-write, prune/snapshot tooling bugs.
Related errors
- error while incrementing period: %w
- error while creating a new delegation period record: %w
- failed to read upgrade info from disk %s
- newValAddr is not of type bytes.HexBytes
- newValPubKey is not of type crypto.PubKey
AI-assisted analysis of unionlabs/union@031785bb6d (2026-08-16).
Data as JSON: /api/errors/d62ee27929c38ec1.
Report an issue: GitHub.