{"record":{"id":"c7359210985b9b82","repo":"linera-io/linera-protocol","slug":"incorrectclaimamount","errorCode":"IncorrectClaimAmount","errorMessage":"ExecutionError::IncorrectClaimAmount","messagePattern":"ExecutionError::IncorrectClaimAmount","errorType":"exception","errorClass":"ExecutionError","httpStatus":null,"severity":"error","filePath":"linera-execution/src/system.rs","lineNumber":774,"sourceCode":"        self.credit_or_send_message(source, recipient, amount).await\n    }\n\n    /// Claims `amount` from `source`'s account on `target_id` and transfers it to `recipient`.\n    pub async fn claim(\n        &mut self,\n        authenticated_owner: Option<AccountOwner>,\n        authenticated_application_id: Option<ApplicationId>,\n        source: AccountOwner,\n        target_id: ChainId,\n        recipient: Account,\n        amount: Amount,\n    ) -> Result<Option<OutgoingMessage>, ExecutionError> {\n        ensure!(\n            authenticated_owner == Some(source)\n                || authenticated_application_id.map(AccountOwner::from) == Some(source),\n            ExecutionError::UnauthenticatedClaimOwner\n        );\n        ensure!(amount > Amount::ZERO, ExecutionError::IncorrectClaimAmount);\n\n        let current_chain_id = self.context().extra().chain_id();\n        if target_id == current_chain_id {\n            // Handle same-chain claim locally by processing the withdraw operation directly\n            self.debit(&source, amount).await?;\n            self.credit_or_send_message(source, recipient, amount).await\n        } else {\n            // Handle cross-chain claim with Withdraw message\n            let message = SystemMessage::Withdraw {\n                amount,\n                owner: source,\n                recipient,\n            };\n            Ok(Some(\n                OutgoingMessage::new(target_id, message)\n                    .with_authenticated_owner(authenticated_owner),\n            ))\n        }","sourceCodeStart":756,"sourceCodeEnd":792,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-execution/src/system.rs#L756-L792","documentation":"Claims must move a strictly positive amount; this error is raised when a Claim operation carries Amount::ZERO. It fires after the owner-authentication check and before any debit or Withdraw message is produced, so no state changes occur.","triggerScenarios":"Submitting SystemOperation::Claim with amount zero; an application calling runtime.claim(source, destination, Amount::ZERO); claim amounts derived from queried remote balances or user input that evaluated to zero (e.g. wrong account queried, so the computed amount underflowed to zero).","commonSituations":"Automation that claims 'the whole balance' of an account it misidentified, computing zero; empty or zero-valued amount strings parsed from CLI/GraphQL; test flows exercising claim with placeholder amounts.","solutions":["Validate amount > Amount::ZERO before building the Claim operation.","If the amount is derived from a queried balance, verify the queried account and chain are the ones you intend to claim from.","Reject zero-valued user input at the API boundary with checked parsing."],"exampleFix":"// before\nruntime.claim(source, destination, Amount::ZERO); // IncorrectClaimAmount\n\n// after\nensure!(!amount.is_zero(), \"claim amount must be positive\");\nruntime.claim(source, destination, amount);","handlingStrategy":"validation","validationCode":"ensure!(\n    !amount.is_zero(),\n    \"claim amount must be positive\"\n);","typeGuard":"fn is_incorrect_claim_amount(e: &ExecutionError) -> bool {\n    matches!(e, ExecutionError::IncorrectClaimAmount)\n}","tryCatchPattern":"match result {\n    Err(ExecutionError::IncorrectClaimAmount) => {\n        // Claim amount was zero: fix the amount computation/input, then resubmit.\n    }\n    Err(e) => return Err(e.into()),\n    Ok(value) => { /* ... */ }\n}","preventionTips":["Validate claim amounts as positive before building the operation.","When claiming a queried remote balance, verify the queried account is the intended one so the derived amount is not zero.","Handle empty/zero user input with a clear client-side error."],"tags":["linera","claim","amount","validation"],"backgroundTag":"zero-amount-transfer","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}