diem/diem · critical

Should have generated a trusted peer set

Error message

Should have generated a trusted peer set

What it means

Immediately after role dispatch, main() unwraps the config-generation result with .expect("Should have generated a trusted peer set"). If gen_validator_full_node_seed_peer_config returns Err (it could not fetch/build a trusted peer set from the endpoint), the process panics with this message.

Source

Thrown at config/seed-peer-generator/src/main.rs:33

    /// The output directory
    output_dir: PathBuf,
    #[structopt(short = "e", long)]
    /// JSON RPC endpoint
    endpoint: String,
    #[structopt(short = "r", long)]
    role: RoleType,
}

fn main() {
    let args = Args::from_args();

    let seed_peers_config = match args.role {
        RoleType::FullNode => {
            seed_peer_generator::utils::gen_validator_full_node_seed_peer_config(args.endpoint)
        }
        _ => panic!("{} not yet supported", args.role),
    }
    .expect("Should have generated a trusted peer set");

    // Save to a file for loading later
    seed_peers_config
        .save_config(args.output_dir.join("seed_peers.yaml"))
        .expect("Unable to save seed peers config");
}

View on GitHub (pinned to fc4714a8ea)

Solutions

  1. Verify the --endpoint URL is correct and reachable (curl it)
  2. Ensure the target validator/node is running and fully synced
  3. Check network/firewall connectivity from the generator host
  4. Fix the underlying cause surfaced before the expect (e.g. response parse error)

Example fix

# before
seed-peer-generator --role fullnode --endpoint http://wrong-host:8080
# after
seed-peer-generator --role fullnode --endpoint http://valid-node:8080
Defensive patterns

Strategy: try-catch

Validate before calling

// probe endpoint before generating
if ! curl -fsS --max-time 5 "$ENDPOINT" > /dev/null; then
  echo "endpoint $ENDPOINT unreachable"; exit 1;
fi

Try / catch

// main() panics via expect; wrap generation logic when reusing it
let peer = gen_validator_full_node_seed_peer_config(endpoint)
    .map_err(|e| { eprintln!("generation failed: {}", e); e })?;

Prevention

When it happens

Trigger: Running seed-peer-generator where the endpoint (args.endpoint) is unreachable, returns invalid data, or otherwise fails config generation, causing the Option/Result to be None/Err.

Common situations: Wrong or unreachable --endpoint URL, remote validator not up yet, network/firewall blocking the call, endpoint returning malformed response.

Related errors


AI-assisted analysis of diem/diem@fc4714a8ea (2026-09-04). Data as JSON: /api/errors/534fde9793f7292c. Report an issue: GitHub.