linera-io/linera-protocol · error · ExecutionError
IncorrectClaimAmount
IncorrectClaimAmount
Error message
ExecutionError::IncorrectClaimAmount
What it means
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.
Source
Thrown at linera-execution/src/system.rs:774
self.credit_or_send_message(source, recipient, amount).await
}
/// Claims `amount` from `source`'s account on `target_id` and transfers it to `recipient`.
pub async fn claim(
&mut self,
authenticated_owner: Option<AccountOwner>,
authenticated_application_id: Option<ApplicationId>,
source: AccountOwner,
target_id: ChainId,
recipient: Account,
amount: Amount,
) -> Result<Option<OutgoingMessage>, ExecutionError> {
ensure!(
authenticated_owner == Some(source)
|| authenticated_application_id.map(AccountOwner::from) == Some(source),
ExecutionError::UnauthenticatedClaimOwner
);
ensure!(amount > Amount::ZERO, ExecutionError::IncorrectClaimAmount);
let current_chain_id = self.context().extra().chain_id();
if target_id == current_chain_id {
// Handle same-chain claim locally by processing the withdraw operation directly
self.debit(&source, amount).await?;
self.credit_or_send_message(source, recipient, amount).await
} else {
// Handle cross-chain claim with Withdraw message
let message = SystemMessage::Withdraw {
amount,
owner: source,
recipient,
};
Ok(Some(
OutgoingMessage::new(target_id, message)
.with_authenticated_owner(authenticated_owner),
))
}View on GitHub (pinned to 6c226ddcb3)
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.
Example fix
// before runtime.claim(source, destination, Amount::ZERO); // IncorrectClaimAmount // after ensure!(!amount.is_zero(), "claim amount must be positive"); runtime.claim(source, destination, amount);
Defensive patterns
Strategy: validation
Validate before calling
ensure!(
!amount.is_zero(),
"claim amount must be positive"
); Type guard
fn is_incorrect_claim_amount(e: &ExecutionError) -> bool {
matches!(e, ExecutionError::IncorrectClaimAmount)
} Try / catch
match result {
Err(ExecutionError::IncorrectClaimAmount) => {
// Claim amount was zero: fix the amount computation/input, then resubmit.
}
Err(e) => return Err(e.into()),
Ok(value) => { /* ... */ }
} Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- IncorrectTransferAmount
- MetaMask is not connected with the requested owner: ${owner}
- Incoming message bundle in block proposed to {chain_id} has
- Checkpoint precondition failed: Checkpoint must be the first
- InvalidCrossChainRequest
AI-assisted analysis of linera-io/linera-protocol@6c226ddcb3 (2026-08-22).
Data as JSON: /api/errors/c7359210985b9b82.
Report an issue: GitHub.