Files
moltbot/src
Logan Ye ef7c528c8a fix(agents): recognize flat JSON billing payloads and snake_case error codes (#74188)
* fix(agents): recognize flat JSON billing payloads and snake_case error codes

Two independent fixes for billing error detection:

1. isErrorPayloadObject/parseApiErrorInfo now recognize flat JSON like
   {"error":"string_code","message":"..."} where error is a string code
   at the top level, not just nested {"error":{"type":"...","message":"..."}}
   envelopes.

2. isBillingErrorMessage now matches "insufficient_balance" (underscore)
   and "Insufficient MBT balance" (one word between insufficient/balance)
   via two new patterns in the billing pattern list.

Together these prevent raw JSON from leaking to user-facing chat when
providers return 402-style flat payloads.

Fixes #74079

* fix(agents): remove redundant billing pattern and fix misleading regex comment
2026-04-29 07:15:45 -04:00
..
2026-04-29 10:23:41 +01:00
2026-04-29 11:44:32 +01:00
2026-04-28 10:54:23 +01:00