affaan-m/ECC · error · SpendLimitError
Single tx exceeds max
Error message
Single tx ${usd_amount} exceeds max ${MAX_SINGLE_TX_USD} What it means
Illustrative hard-limit guard from the llm-trading-agent-security skill: SpendLimitGuard.check_and_record raises SpendLimitError when a single transaction's USD amount exceeds MAX_SINGLE_TX_USD. It fires before the daily-spend check and before any spend is recorded.
Solutions
- Split oversized intents into multiple sub-limit transactions or reject them
- Require human approval for amounts near the cap
- Set caps per environment and alert when they fire
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at skills/llm-trading-agent-security/SKILL.md:63 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of affaan-m/ECC@d8409a4b08 (2026-08-26).
Data as JSON: /api/errors/ae037c0241120b59.
Report an issue: GitHub.
Appendix: source
Thrown at skills/llm-trading-agent-security/SKILL.md:63
```
Do not blindly inject token names, pair labels, webhooks, or social feeds into an execution-capable prompt.
### Hard spend limits
```python
from decimal import Decimal
MAX_SINGLE_TX_USD = Decimal("500")
MAX_DAILY_SPEND_USD = Decimal("2000")
class SpendLimitError(Exception):
pass
class SpendLimitGuard:
def check_and_record(self, usd_amount: Decimal) -> None:
if usd_amount > MAX_SINGLE_TX_USD:
raise SpendLimitError(f"Single tx ${usd_amount} exceeds max ${MAX_SINGLE_TX_USD}")
daily = self._get_24h_spend()
if daily + usd_amount > MAX_DAILY_SPEND_USD:
raise SpendLimitError(f"Daily limit: ${daily} + ${usd_amount} > ${MAX_DAILY_SPEND_USD}")
self._record_spend(usd_amount)
```
### Simulate before sending
```python
class SlippageError(Exception):
pass
async def safe_execute(self, tx: dict, expected_min_out: int | None = None) -> str:
sim_result = await self.w3.eth.call(tx)
if expected_min_out is None:View on GitHub (pinned to d8409a4b08)