{"record":{"id":"88881ebc805e664c","repo":"diem/diem","slug":"failed-to-generate-txn-effects","errorCode":null,"errorMessage":"Failed to generate txn effects","messagePattern":"Failed to generate txn effects","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"language/testing-infra/e2e-tests/src/executor.rs","lineNumber":512,"sourceCode":"            let remote_view = RemoteStorage::new(&self.data_store);\n            let mut session = vm.new_session(&remote_view);\n            session\n                .execute_function(\n                    &Self::module(module_name),\n                    &Self::name(function_name),\n                    type_params,\n                    args,\n                    &mut gas_status,\n                )\n                .unwrap_or_else(|e| {\n                    panic!(\n                        \"Error calling {}.{}: {}\",\n                        module_name,\n                        function_name,\n                        e.into_vm_status()\n                    )\n                });\n            let (changeset, events) = session.finish().expect(\"Failed to generate txn effects\");\n            let (writeset, _events) = convert_changeset_and_events(changeset, events)\n                .expect(\"Failed to generate writeset\");\n            writeset\n        };\n        self.data_store.add_write_set(&write_set);\n    }\n\n    pub fn try_exec(\n        &mut self,\n        module_name: &str,\n        function_name: &str,\n        type_params: Vec<TypeTag>,\n        args: Vec<Vec<u8>>,\n    ) -> Result<WriteSet, VMStatus> {\n        let mut gas_status = GasStatus::new_unmetered();\n        let vm = MoveVM::new(diem_vm::natives::diem_natives()).unwrap();\n        let remote_view = RemoteStorage::new(&self.data_store);\n        let mut session = vm.new_session(&remote_view);","sourceCodeStart":494,"sourceCodeEnd":530,"githubUrl":"https://github.com/diem/diem/blob/fc4714a8ea273b6efe8b13dbce72ea60aad9a16c/language/testing-infra/e2e-tests/src/executor.rs#L494-L530","documentation":"In the e2e test executor's exec(), after executing a function in a Move session, session.finish() is unwrapped with this panic message. It fires when the session cannot produce a changeset (e.g. the transaction aborted mid-execution leaving inconsistent state, or resource/enum deserialization problems).","triggerScenarios":"Calling exec (used by test_diem_initialize, publish_and_register_new_currency, etc.) when the underlying MoveVM session finish() returns an error — typically an aborted transaction or invalid state update.","commonSituations":"Tests that call exec with scripts/functions that abort, or data store state inconsistent with what the session expects (e.g. initializing Diem twice).","solutions":["Check the preceding 'Error calling module.function' log message to find the abort cause and fix the called Move code or test inputs.","Use try_exec (which maps errors to VMStatus) instead of exec for transactions expected to fail.","Ensure the data store state is fresh/valid (e.g. don't re-initialize an already initialized chain)."],"exampleFix":"// before\nexecutor.exec(initialize_script, ...); // aborts -> panic in session.finish()\n// after\nexecutor.try_exec(initialize_script, ...).expect(\"init should succeed\");","handlingStrategy":"try-catch","validationCode":"// prefer try_exec when a transaction may abort\nlet result = executor.try_exec(&script, ty_args, args);","typeGuard":null,"tryCatchPattern":"match std::panic::catch_unwind(|| executor.exec(...)) {\n    Ok(ws) => use(ws),\n    Err(p) if panic_msg_contains(p, \"Failed to generate txn effects\") =>\n        eprintln!(\"check the 'Error calling module.function' log above\"),\n    Err(p) => resume_unwind(p),\n}","preventionTips":["Use try_exec instead of exec for transactions that might abort.","Read the preceding 'Error calling <module>.<function>' message to identify the root cause.","Don't re-run initialization transactions on already-initialized chain state."],"tags":["diem","e2e-tests","move-vm","session"],"backgroundTag":"txn-effect-generation-failed","analyzedSha":"fc4714a8ea273b6efe8b13dbce72ea60aad9a16c","analyzedAt":"2026-09-04T21:07:05.890Z","contentChangedAt":"2026-09-04T21:07:05.890Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}