AgentSkillsCN

troubleshoot-errors

诊断并修复常见的Algorand错误,包括智能合约失败、交易拒绝以及SDK异常。当遇到智能合约逻辑错误或断言失败、交易拒绝或确认超时、SDK异常(AlgodHTTPError、LogicError)、账户相关错误(余额不足、未参与)、或ABI编码/解码错误时,可使用此功能。强烈触发词包括:“逻辑求值错误”、“断言失败”、“超支”、“交易拒绝”、“错误信息中出现‘pc=X’”、“操作码预算超限”、“账户未找到”、“资产未找到”。

SKILL.md
--- frontmatter
name: troubleshoot-errors
description: Diagnose and fix common Algorand errors including smart contract failures, transaction rejections, and SDK exceptions. Use when encountering smart contract logic errors or assertion failures, transaction rejections or confirmation timeouts, SDK exceptions (AlgodHTTPError, LogicError), account-related errors (insufficient balance, not opted in), or ABI encoding/decoding errors. Strong triggers include "logic eval error", "assert failed", "overspend", "transaction rejected", "pc=X" in error messages, "opcode budget exceeded", "account not found", "asset not found".

Troubleshoot Errors

Diagnose and resolve common Algorand development errors.

Error Categories

CategoryCommon CausesReference
Contract ErrorsAssert failures, opcode budget, invalid operationscontract-errors.md
Transaction ErrorsOverspend, invalid params, group issuestransaction-errors.md

Quick Diagnosis Flow

  1. Identify the error type from the message
  2. Check the error code if present (e.g., pc=123)
  3. Find the root cause using the reference docs
  4. Apply the fix from the common solutions

Common Error Patterns

Logic Eval Error (Contract Failure)

code
logic eval error: assert failed pc=123

Cause: An assert statement in the smart contract evaluated to false.

Debug steps:

  1. The pc=123 indicates the program counter where failure occurred
  2. Use source maps to find the exact line in your code
  3. Check the assertion condition and input values

Transaction Rejected

code
TransactionPool.Remember: transaction TXID: overspend

Cause: Sender account has insufficient balance for amount + fee.

Fix: Fund the sender account or reduce the transaction amount.

Opcode Budget Exceeded

code
logic eval error: dynamic cost budget exceeded

Cause: Contract exceeded the 700 opcode budget per app call.

Fix:

  • Add more app calls to the group for additional budget (pooled)
  • Optimize contract logic to reduce operations
  • Split complex operations across multiple calls

Asset Not Opted In

code
asset ASSET_ID missing from ACCOUNT_ADDRESS

Cause: The receiving account hasn't opted into the asset.

Fix: Have the receiver opt in before transferring:

python
algorand.send.asset_opt_in(AssetOptInParams(
    sender=receiver_address,
    asset_id=asset_id,
))

How to Proceed

  1. Find your error in the category references below
  2. Understand the cause from the explanation
  3. Apply the solution from the code examples

References