While hunting open-source bounties across the Stellar / Soroban Rust CLI ( stellar/stellar-cli ) today, I ran into three deceptively subtle CLI and contract parser bugs that pass normal unit tests yet fail quietly in production.
If you build Rust CLIs with clap , parse JSON into typed contract ABIs, or design tool-call sandboxes for AI agents, these three patterns are worth auditing in your own codebase.
1. Silent .zip() Truncation on JSON Tuple-Struct Arrays
When parsing untyped JSON arrays into typed Rust tuple structs (like Soroban contract spec types), it is tempting to pair the incoming serde_json::Value::Array elements with the struct's field definitions using .iter().zip() :
Value :: Array ( array ) => { if array . len ( ) != strukt . fields . len ( ) { return Err ( Error :: InvalidValue ( Some ( Type :: Udt ( Udt { name : strukt . name . clone ( ) , } ) ) ) ) ; } let fields : Result < Vec < _ > , _ > = array . iter ( ) . zip ( strukt . fields . iter ( ) ) . map ( | ( val , field ) | self .…