{"record":{"id":"9dccf9c4621b920b","repo":"linera-io/linera-protocol","slug":"should-execute-block-with-openchain-operations","errorCode":null,"errorMessage":"should execute block with OpenChain operations","messagePattern":"should execute block with OpenChain operations","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"linera-client/src/client_context.rs","lineNumber":1307,"sourceCode":"        owners: Vec<AccountOwner>,\n    ) -> Result<ConfirmedBlockCertificate, Error> {\n        let operations: Vec<_> = owners\n            .iter()\n            .map(|owner| {\n                let config = OpenChainConfig {\n                    ownership: ChainOwnership::single_super(*owner),\n                    account: AccountOwner::CHAIN,\n                    balance,\n                    application_permissions: Default::default(),\n                };\n                Operation::system(SystemOperation::OpenChain(config))\n            })\n            .collect();\n        info!(\"Executing {} OpenChain operations\", operations.len());\n        Ok(chain_client\n            .execute_operations(operations, vec![])\n            .await?\n            .expect(\"should execute block with OpenChain operations\"))\n    }\n\n    /// Supplies fungible tokens to the chains.\n    async fn supply_fungible_tokens(\n        &mut self,\n        key_pairs: &[(ChainId, AccountOwner)],\n        application_id: ApplicationId,\n    ) -> Result<(), Error> {\n        let default_chain_id = self.default_chain();\n        let default_key = self\n            .wallet()\n            .get(default_chain_id)\n            .await\n            .unwrap()\n            .unwrap()\n            .owner\n            .unwrap();\n        // This should be enough to run the benchmark at 1M TPS for an hour.","sourceCodeStart":1289,"sourceCodeEnd":1325,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-client/src/client_context.rs#L1289-L1325","documentation":"execute_open_chains_operations (linera-client/src/client_context.rs:1286) submits a batch of OpenChain operations and calls ClientOutcome::expect on the result. ChainClient::execute_operations returns ClientOutcome<ConfirmedBlockCertificate>: Committed, WaitForTimeout (this client is not the leader of the current consensus round), or Conflict (another block was already committed at the next height). expect panics on anything except Committed, so this fires when the block could not be immediately committed during benchmark chain creation.","triggerScenarios":"Running benchmark preparation (prepare_for_benchmark / make_benchmark_chains flow) when the default chain's current round is led by another owner: a second client process operating the same chain/wallet, a leftover run still committing blocks, or multi-owner ownership where this client lost leadership.","commonSituations":"Two benchmark or client processes pointed at the same wallet or chain concurrently; re-running benchmarks before the previous run's blocks finished committing; chain ownership changed to multiple owners so WaitForTimeout becomes possible.","solutions":["Ensure only one client process operates the wallet/default chain at a time; stop stale benchmark processes before starting a new run.","Wait for in-flight blocks and the current round to finalize, then retry the benchmark command.","If embedding, replace the expect with a match on ClientOutcome that sleeps until RoundTimeout.timestamp and retries, or resynchronizes on Conflict.","Keep the default chain under single ownership during benchmark setup so leadership is unambiguous."],"exampleFix":"// before\nOk(chain_client\n    .execute_operations(operations, vec![])\n    .await?\n    .expect(\"should execute block with OpenChain operations\"))\n\n// after\nmatch chain_client.execute_operations(operations, vec![]).await? {\n    ClientOutcome::Committed(certificate) => Ok(certificate),\n    ClientOutcome::WaitForTimeout(timeout) => {\n        tokio::time::sleep_until(timeout.timestamp.into()).await;\n        // retry the batch\n    }\n    ClientOutcome::Conflict(certificate) => {\n        // another block landed at this height: resynchronize and re-prepare\n    }\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":"fn is_committed<T>(outcome: &ClientOutcome<T>) -> bool {\n    matches!(outcome, ClientOutcome::Committed(_))\n}","tryCatchPattern":"// Instead of .expect, handle all three outcomes; retry is the correct strategy:\nloop {\n    match chain_client.execute_operations(operations.clone(), vec![]).await? {\n        ClientOutcome::Committed(cert) => return Ok(cert),\n        ClientOutcome::WaitForTimeout(t) => tokio::time::sleep_until(t.timestamp.into()).await,\n        ClientOutcome::Conflict(_) => { /* resynchronize chain, re-derive operations, retry */ }\n    }\n}","preventionTips":["Run exactly one client/wallet process per chain; serialize benchmark runs.","Wait for prior runs' blocks to finalize (chain height settles) before starting benchmark preparation.","Keep benchmark chains under single ownership so WaitForTimeout cannot occur."],"tags":["linera-client","benchmark","consensus-round","conflict","panic"],"backgroundTag":"concurrent-commit-conflict","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}