FuelLabs/sway · error · anyhow::Error

missing used gas information from test execution

Error message

missing used gas information from test execution

What it means

Error "missing used gas information from test execution" thrown in FuelLabs/sway.

Source

Thrown at forc-test/src/execute.rs:300

            file_path,
            duration,
            span,
            state: state.unwrap(),
            condition,
            logs,
            gas_used,
            ecal: Box::new(self.interpreter.ecal_state().clone()),
        })
    }

    fn get_gas_and_receipts(receipts: Vec<Receipt>) -> anyhow::Result<(u64, Vec<Receipt>)> {
        let gas_used = *receipts
            .iter()
            .find_map(|receipt| match receipt {
                tx::Receipt::ScriptResult { gas_used, .. } => Some(gas_used),
                _ => None,
            })
            .ok_or_else(|| anyhow::anyhow!("missing used gas information from test execution"))?;

        // Only retain `Log` and `LogData` receipts.
        let logs = receipts
            .into_iter()
            .filter(|receipt| {
                matches!(receipt, tx::Receipt::Log { .. })
                    || matches!(receipt, tx::Receipt::LogData { .. })
            })
            .collect();
        Ok((gas_used, logs))
    }
}

fn find_jump_instruction_index(bytecode: &[u8]) -> usize {
    // Search first `move $$locbase $sp`
    // This will be `__entry` for script/predicate/contract using encoding v1;
    // `main` for script/predicate using encoding v0;
    // or the first function for libraries

View on GitHub (pinned to 47e5e902fa)

When it happens

Trigger: Thrown at forc-test/src/execute.rs:300 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of FuelLabs/sway@47e5e902fa (2026-08-16). Data as JSON: /api/errors/e289ddff1df85154. Report an issue: GitHub.