affaan-m/ECC · error · ValueError

min_amount_out is required before send

Error message

min_amount_out is required before send

What it means

Illustrative pre-send guard from the llm-trading-agent-security skill: safe_execute simulated the transaction but expected_min_out is None, so slippage cannot be bounded and the send is refused. The unsigned transaction dict is missing its min_amount_out parameter.

Solutions

  1. Always compute min_amount_out from a fresh quote before building the tx
  2. Reject any swap whose route cannot express a minimum output
  3. Fail closed: never send without a slippage bound
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at skills/llm-trading-agent-security/SKILL.md:82 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/e4efc47078d45a40. Report an issue: GitHub.

Appendix: source

Thrown at skills/llm-trading-agent-security/SKILL.md:82

        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:
        raise ValueError("min_amount_out is required before send")

    actual_out = decode_uint256(sim_result)
    if actual_out < expected_min_out:
        raise SlippageError(f"Simulation: {actual_out} < {expected_min_out}")

    signed = self.account.sign_transaction(tx)
    return await self.w3.eth.send_raw_transaction(signed.raw_transaction)
```

### Circuit breaker

```python
class TradingCircuitBreaker:
    MAX_CONSECUTIVE_LOSSES = 3
    MAX_HOURLY_LOSS_PCT = 0.05

    def check(self, portfolio_value: float) -> None:
        if self.consecutive_losses >= self.MAX_CONSECUTIVE_LOSSES:

View on GitHub (pinned to d8409a4b08)