Skip to content

fix: Memory and concurrent-run limit errors use the wrong API error types #1592

Open

Description

@jirispilka

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-exceeded instead of actor-memory-limit-exceeded
  • cannot-start-actor-runs instead of concurrent-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-exceeded
  • APIFY_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-exceeded in 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, and utils.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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    t-aiIssues owned by the AI team.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions