{"record":{"id":"a75c9f09d11d0781","repo":"linera-io/linera-protocol","slug":"should-execute-block-with-transfer-operations","errorCode":null,"errorMessage":"should execute block with Transfer operations","messagePattern":"should execute block with Transfer operations","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"linera-client/src/client_context.rs","lineNumber":1339,"sourceCode":"            .unwrap()\n            .unwrap()\n            .owner\n            .unwrap();\n        // This should be enough to run the benchmark at 1M TPS for an hour.\n        let amount = Amount::from_nanos(4);\n        let operations: Vec<Operation> = key_pairs\n            .iter()\n            .map(|(chain_id, owner)| {\n                fungible_transfer(application_id, *chain_id, default_key, *owner, amount)\n            })\n            .collect();\n        let chain_client = self.make_chain_client(default_chain_id).await?;\n        // Put at most 1000 fungible token operations in each block.\n        for operation_chunk in operations.chunks(1000) {\n            chain_client\n                .execute_operations(operation_chunk.to_vec(), vec![])\n                .await?\n                .expect(\"should execute block with Transfer operations\");\n        }\n        self.update_wallet_from_client(&chain_client).await?;\n\n        Ok(())\n    }\n}\n","sourceCodeStart":1321,"sourceCodeEnd":1346,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-client/src/client_context.rs#L1321-L1346","documentation":"supply_fungible_tokens (linera-client/src/client_context.rs:1311) pushes fungible-token Transfer operations in chunks of up to 1000 and calls ClientOutcome::expect on each chunk's result. As with error 422, execute_operations returns ClientOutcome and expect panics unless the chunk was Committed - i.e. the client hit WaitForTimeout (not the round leader) or Conflict (another block committed at the same height).","triggerScenarios":"prepare_for_benchmark reaching the token-distribution step while another process commits to the default chain, or while the client must wait out a round timeout before it may propose the next block. Each 1000-operation chunk must commit, so a single non-Committed outcome aborts the whole run.","commonSituations":"Concurrent benchmark runs sharing one wallet/default chain; a long-running client (e.g. a wallet service) still operating the chain during benchmark preparation; leadership rotation on jointly owned chains.","solutions":["Stop every other client or benchmark process using the same wallet/default chain, then re-run.","Let pending blocks and the current round settle before invoking benchmark preparation.","If embedding, loop on ClientOutcome: on WaitForTimeout sleep until the timeout timestamp and retry the same chunk; on Conflict resynchronize the chain and re-prepare the operations.","Confirm the default chain has single ownership during the benchmark."],"exampleFix":"// before\nfor operation_chunk in operations.chunks(1000) {\n    chain_client\n        .execute_operations(operation_chunk.to_vec(), vec![])\n        .await?\n        .expect(\"should execute block with Transfer operations\");\n}\n\n// after\nfor operation_chunk in operations.chunks(1000) {\n    loop {\n        match chain_client\n            .execute_operations(operation_chunk.to_vec(), vec![])\n            .await?\n        {\n            ClientOutcome::Committed(_) => break,\n            ClientOutcome::WaitForTimeout(t) => {\n                tokio::time::sleep_until(t.timestamp.into()).await\n            }\n            ClientOutcome::Conflict(_) => { /* resync chain state, then retry chunk */ }\n        }\n    }\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":"fn is_committed<T>(outcome: &ClientOutcome<T>) -> bool {\n    matches!(outcome, ClientOutcome::Committed(_))\n}","tryCatchPattern":"for chunk in operations.chunks(1000) {\n    loop {\n        match chain_client.execute_operations(chunk.to_vec(), vec![]).await? {\n            ClientOutcome::Committed(_) => break,\n            ClientOutcome::WaitForTimeout(t) => tokio::time::sleep_until(t.timestamp.into()).await,\n            ClientOutcome::Conflict(_) => { /* resync and retry the same chunk */ }\n        }\n    }\n}","preventionTips":["Never run two token-distribution or benchmark jobs against the same default chain concurrently.","Ensure the default chain has a funded balance before supply_fungible_tokens so blocks commit on the first attempt.","In automation, retry the whole benchmark-prepare step once after a cooldown rather than crashing."],"tags":["linera-client","benchmark","fungible-tokens","consensus-round","panic"],"backgroundTag":"concurrent-commit-conflict","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}