linera-io/linera-protocol · error

no admin chain (Root(0)) in genesis config

Error message

no admin chain (Root(0)) in genesis config

What it means

The 'init-light-client' command queries the faucet's GraphQL endpoint for currentCommittee, currentEpoch and genesisConfig, then requires a genesis chain whose origin is ChainOrigin::Root(0) — the Linera admin chain. This error means genesisConfig.chains contains no Root(0) entry, so the light client cannot be initialized from this endpoint.

Source

Thrown at linera-bridge/src/main.rs:338

        let client = reqwest::Client::new();

        let resp = client
            .post(&self.faucet_url)
            .json(&serde_json::json!({
                "query": "{ currentCommittee { validators } currentEpoch genesisConfig }"
            }))
            .send()
            .await?
            .json::<GqlResponse>()
            .await?;

        let admin_chain_id = resp
            .data
            .genesis_config
            .chains
            .iter()
            .find(|c| c.origin() == ChainOrigin::Root(0))
            .ok_or_else(|| anyhow::anyhow!("no admin chain (Root(0)) in genesis config"))?
            .id();
        let admin_chain_bytes = *admin_chain_id.0.as_bytes();

        let mut validators: Vec<String> = Vec::new();
        let mut weights: Vec<u64> = Vec::new();

        for (public_key, state) in &resp.data.current_committee.validators {
            let address = validator_evm_address(public_key);
            validators.push(format!("{address}"));
            weights.push(state.votes);
        }

        let result = serde_json::json!({
            "validators": validators,
            "weights": weights,
            "admin_chain_id": format!("0x{}", alloy_primitives::hex::encode(admin_chain_bytes)),
            "epoch": resp.data.current_epoch,
            "pause_guardian": self.pause_guardian,

View on GitHub (pinned to 6c226ddcb3)

Solutions

  1. Point --faucet-url at the faucet of the exact network the bridge targets
  2. Run the raw query '{ genesisConfig { chains { id } } }' against the faucet and confirm a Root(0)-origin chain exists
  3. For private networks, regenerate genesis so the admin chain is created as ChainOrigin::Root(0)
Defensive patterns

Strategy: try-catch

Validate before calling

// Preflight: query the faucet and confirm Root(0) exists before running the command.
let resp: serde_json::Value = client.post(&faucet_url)
    .json(&serde_json::json!({"query": "{ genesisConfig { chains { id } } }"}))
    .send().await?.json().await?;
assert!(resp["data"]["genesisConfig"]["chains"].as_array().is_some_and(|c| !c.is_empty()));

Try / catch

match InitLightClientOptions::run(&opts).await {
    Err(e) if e.to_string().contains("no admin chain") => {
        // wrong network: stop and re-check --faucet-url instead of proceeding
    }
    other => other?,
}

Prevention

When it happens

Trigger: Running init-light-client with --faucet-url pointing at a network whose genesis config has no Root(0) chain: a custom/devnet genesis where the admin chain is not the first root chain, a staging or incompatible network, or a faucet version that returns a partial genesisConfig.

Common situations: Wrong --faucet-url (testnet faucet instead of the target network); running a private Linera network whose genesis was generated with a different admin chain setup; faucet/API version mismatch after an upgrade.

Related errors


AI-assisted analysis of linera-io/linera-protocol@6c226ddcb3 (2026-08-22). Data as JSON: /api/errors/909172778f55179f. Report an issue: GitHub.