Commit 80aeebb
fix: Handle NEAR nested error strings as valid JSON-RPC success
NEAR's JSON-RPC returns execution errors as strings nested inside the
result object: {"result":{"error":"wasm execution failed..."},"id":1}
The heuristic was detecting "error" via substring match, seeing both
"result" and "error" present, and flagging it as jsonrpc_both_result_and_error
(malformed). This triggered retry, reputation penalty, and circuit breaking
for all NEAR suppliers returning wasm execution errors.
Fix: when both "result" and "error" are found, check if "error" is a
top-level JSON-RPC error object ("error": {) or a nested string
("error": "..."). Only flag as malformed if it's a top-level error object.
Uses whitespace-tolerant scanning consistent with emptyResultType().
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 62afc4c commit 80aeebb
2 files changed
Lines changed: 55 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
210 | 222 | | |
211 | 223 | | |
212 | 224 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
340 | 340 | | |
341 | 341 | | |
342 | 342 | | |
343 | | - | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
344 | 349 | | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
345 | 360 | | |
346 | | - | |
347 | | - | |
348 | | - | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
349 | 364 | | |
350 | | - | |
| 365 | + | |
351 | 366 | | |
352 | 367 | | |
353 | 368 | | |
| |||
557 | 572 | | |
558 | 573 | | |
559 | 574 | | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
560 | 598 | | |
561 | 599 | | |
562 | 600 | | |
| |||
0 commit comments