'no method named resize found for solana_account_info::AccountInfo' with Anchor 0.32 — pin via cargo update solana-account-info --precise 2.3.0
Symptom: a native Solana program depends on an Anchor 0.32.x program crate with the cpi feature, and the build fails with no method named 'resize' found for struct solana_account_info::AccountInfo<'a> in the current scope. Cargo.lock shows solana-account-info 2.3.0 somewhere, and dev-dependencies pin solana-sdk 3.x, so the version story looks fine.
Cause: AccountInfo::resize was added in solana-account-info 2.3.0. Anchor declares a loose semver range for that crate, so Cargo is free to unify it down to 2.2.0 (or lower) to satisfy another dependency in the graph — and then Anchor's own code, which calls resize, no longer compiles. The error names Anchor-adjacent code but the cause is version unification in your workspace.
Fix: force the resolved version up.
cargo update solana-account-info --precise 2.3.0If the graph contains several copies you get
error: There are multiple `solana-account-info` packages in your project, and the specification `solana-account-info` is ambiguous.
Please re-run this command with one of the following specifications:
solana-account-info@2.2.0
solana-account-info@3.1.0Select the one *below* 2.3.0 and bump only that copy — leave any 3.x entry alone:
cargo update solana-account-info@2.2.0 --precise 2.3.0Diagnostic habit worth keeping: when a dependency's own source fails to compile over a missing method, run cargo tree -i <crate> (or grep Cargo.lock for duplicate entries) before touching your code. Mixing solana-sdk 3.x in dev-dependencies with 2.x program crates is what widens the graph enough for this to happen.
Source: adapted from a Stack Exchange answer by abelmarnk (question by Jonas H.), https://solana.stackexchange.com/questions/23773/no-method-named-resize-found-for-struct-solana-account-infoaccountinfoa — CC BY-SA 4.0
Checked against the published crate sources: solana-account-info 2.2.1's lib.rs has only 'pub fn realloc', and 2.3.0 adds 'pub fn resize(&self, new_len: usize)' (lib.rs:197), so the 2.3.0 floor is right. The pkg@version form also works as described (cargo 1.99.1, toy graph with rand 0.7 + 0.8): 'cargo update rand@0.7.3 --precise 0.7.2' changes only that copy and leaves 0.8.8 alone. Version caveat if you grep for the error: current cargo words the ambiguity as 'error: specification
randis ambiguous' / 'help: re-run this command with one of the following specifications', not 'There are multiple ... packages in your project'. Also, cargo only resolves BELOW the highest compatible version when something forces it, usually an existing Cargo.lock or another crate's tighter requirement ('cargo tree -i solana-account-info@2.2.0' shows which). A fresh lockfile with no such constraint picks the newest 2.x.