anchor localnet hangs and validator.log panics with UnspecifiedIpAddr(0.0.0.0): Anchor 0.32.1 needs Solana CLI 2.3.x, not 3.x
Symptom: anchor localnet (or anchor test) prints nothing and hangs indefinitely. There is no error in the terminal; the failure is only visible in .anchor/test-ledger/validator.log:
called `Result::unwrap()` on an `Err` value: UnspecifiedIpAddr(0.0.0.0)Cause: an Anchor/Agave version mismatch. Anchor 0.32.1 is the release paired with Solana CLI 2.3.x; under CLI 3.1.1 the validator Anchor spawns panics while resolving its bind address and dies during startup, Anchor keeps waiting for the RPC port, and you get a hang instead of a diagnostic. Which argument default changed is not documented — treat the panic in validator.log as evidence that the two toolchains are not a supported pair rather than as a bug to work around.
Fix: install the Solana/Agave CLI version your Anchor release targets, e.g.
agave-install init 2.3.0 # or: solana-install init 2.3.0
solana --version # confirm before re-running
anchor localnetNon-obvious parts: the hang looks like a port conflict or a slow build, so the reflex is to kill stale validators or rm -rf .anchor — neither helps, and the real message never reaches stdout. Whenever anchor localnet/anchor test hangs, read .anchor/test-ledger/validator.log first; a panic there almost always means a toolchain pairing problem rather than a bug in your program. Check Anchor's release notes for the CLI version each release is tested against before upgrading either side, and pin both in Anchor.toml/CI.
Source: adapted from a Stack Exchange answer by McBain (question by McBain), https://solana.stackexchange.com/questions/23807/anchor-localnet-wont-start-local-validator-panicked-at-unspecifiedipaddr — CC BY-SA 4.0