Repository navigation
fix: Memory and concurrent-run limit errors use the wrong API error types #1592
Description
Problem
call-actor and direct Actor tools have dedicated account-memory and concurrent-run limit messages, but compare the API error type against the wrong strings:
memory-limit-exceededinstead ofactor-memory-limit-exceededcannot-start-actor-runsinstead ofconcurrent-runs-limit-exceeded
The checks miss and the response instead tells the caller to verify the Actor name or input.
The original hosted observation used an account with a 16 GB memory quota and requested 32768 MB for apify/web-fetch. The response reported exceeding the 16384 MB limit, followed by the generic Actor-name and input hints.
Fix
Change the values of the existing constants in src/const.ts:
APIFY_ERROR_TYPE_MEMORY_LIMIT_EXCEEDED=actor-memory-limit-exceededAPIFY_ERROR_TYPE_CANNOT_START_ACTOR_RUNS=concurrent-runs-limit-exceeded
Reuse the existing matchers in src/utils/apify_errors.ts. Do not rename symbols, add compatibility aliases, broaden matching, or rewrite the dedicated messages.
Before editing, inspect every consumer of the constants and isActorRunLimitError, including call_actor.ts, utils/mcp.ts, tool_status.ts, logging.ts, and payment_errors.ts. Update affected fixtures and comments.
Acceptance
- Regression inputs use the literal API type strings independently of the constants under test.
- Direct memory and concurrent-limit errors receive their existing dedicated messages, without generic Actor-name or input advice.
- A remote-MCP error carrying
concurrent-runs-limit-exceededin an HTTP 500 wrapper receives the concurrent-limit message. - That wrapped concurrent-limit error is logged through the existing client/billing path and classified
SOFT_FAIL / INVALID_INPUT; retain the HTTP status where already recorded. - A concurrent-limit HTTP 402 is excluded from
isX402PaymentRequiredError. A genuine payment-required control still matches. - Update relevant tests in
utils.apify_errors,tools.call_actor_common,utils.logging,utils.tool_status,utils.payment_errors, andutils.mcp.
Write the regression first and confirm it fails before fixing production code. Follow AGENTS.md and tests/UNIT_TESTING_GUIDE.md; run the repository's five required checks. Do not run local integration tests, evals, or paid Actor runs for this issue. Do not repeat the hosted reproduction: on a larger account the request can start a paid run.
Evidence and limits
Checked against 34ac4f22 on October 19, 2026. Controlled errors supplied through mcpc fixture tools to production helpers reproduced both generic hints. The old type strings reached the dedicated messages. A synthetic concurrent-limit HTTP 402 matched x402 payment handling; a synthetic HTTP 500 wrapper became FAILED / INTERNAL_ERROR and logged as an exception.
These local checks verify handling of the supplied types. They do not independently establish the live API's error types or HTTP status codes; the API types above are the settled inputs for this fix.
AI assistance: Codex reproduced the local paths and drafted this update.
Activity