{"record":{"id":"452b81ee1a8c884d","repo":"linera-io/linera-protocol","slug":"incorrect-applicationid","errorCode":null,"errorMessage":"Incorrect ApplicationId","messagePattern":"Incorrect ApplicationId","errorType":"validation","errorClass":"EvmExecutionError","httpStatus":null,"severity":"critical","filePath":"linera-execution/src/evm/database.rs","lineNumber":697,"sourceCode":"    ) -> Result<(), ExecutionError> {\n        let application_id = address_to_user_application_id(address);\n        let mut argument = ALREADY_CREATED_CONTRACT_SELECTOR.to_vec();\n        argument.extend(bcs::to_bytes(account)?);\n        let evm_instantiation = EvmInstantiation {\n            value: U256::ZERO,\n            argument,\n        };\n        let argument = serde_json::to_vec(&evm_instantiation)?;\n        let parameters = JSON_EMPTY_VECTOR.to_vec(); // No constructor\n        let required_application_ids = Vec::new();\n        let mut runtime = self.inner.runtime.lock().unwrap();\n        let created_application_id = runtime.create_application(\n            module_id,\n            parameters,\n            argument,\n            required_application_ids,\n        )?;\n        ensure!(\n            application_id == created_application_id,\n            EvmExecutionError::IncorrectApplicationId\n        );\n        Ok(())\n    }\n\n    /// Commits the changes to another contract.\n    /// This is done by doing a call application.\n    fn commit_remote_contract(\n        &self,\n        address: Address,\n        account: &revm_state::Account,\n    ) -> Result<(), ExecutionError> {\n        let application_id = address_to_user_application_id(address);\n        let mut argument = COMMIT_CONTRACT_CHANGES_SELECTOR.to_vec();\n        argument.extend(bcs::to_bytes(account)?);\n        let mut runtime = self.inner.runtime.lock().unwrap();\n        runtime.try_call_application(false, application_id, argument)?;","sourceCodeStart":679,"sourceCodeEnd":715,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-execution/src/evm/database.rs#L679-L715","documentation":"Raised by ContractDatabase::create_new_contract when registering a freshly created EVM contract as a Linera application: the application id derived from the contract's EVM address (address_to_user_application_id) must equal the id the runtime assigned via create_application(module_id, ...). Linera derives application ids deterministically; a mismatch means the EVM address under which the contract was created does not map to the application the runtime registered — an address-derivation collision or non-determinism in the creation path (e.g. CREATE vs CREATE2 divergence, or an address already hosting another application).","triggerScenarios":"Contract creation where the EVM CREATE/CREATE2 address computation differs from what the bridge derives; deploying a contract at an address that already maps to a different application id; runtime/application-id derivation changes across protocol versions.","commonSituations":"Solidity factories using CREATE2 with salts after bridge upgrades; running old bytecode against a new linera-execution; adversarial inputs engineered to collide with existing application addresses.","solutions":["Reproduce creation on a devnet and log both ids (derived-from-address vs created) to see the divergence","Use a different creation path (plain CREATE instead of CREATE2, or a fresh salt) so the address derivation matches the runtime's expectation","Align the contract's deployment toolchain with the current linera-protocol version","Report with bytecode and creation transaction if the mismatch reproduces on current versions"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"fn is_incorrect_application_id(err: &ExecutionError) -> bool {\n    matches!(err, ExecutionError::EvmError(evm_error!::IncorrectApplicationId))\n}","tryCatchPattern":"match client.execute_operations(ops, vec![]).await {\n    Err(e) if is_incorrect_application_id(&e) => {\n        // Deterministic address derivation diverged; stop and file a report with bytecode + tx.\n        return Err(anyhow::anyhow!(\"EVM address did not map to the registered application id: {e}\"));\n    }\n    other => other,\n}","preventionTips":["Use one creation mechanism consistently (CREATE or a fixed-salt CREATE2) per deployment pipeline","Pin the linera-protocol version used to deploy and to serve; derivation changes break old flows","Smoke-test contract creation on devnet with the exact factory bytecode before mainnet"],"tags":["linera","evm","contract-creation","application-id","determinism"],"backgroundTag":"deterministic-id-mismatch","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}