Help Center/ CodeArts Agent/ FAQs/ Agent/ How Do I Resolve Sandbox Task Terminations Caused by OOM Errors?
Updated on 2026-07-30 GMT+08:00

How Do I Resolve Sandbox Task Terminations Caused by OOM Errors?

Symptom

When a task is running in the sandbox, the task is terminated unexpectedly and a message is displayed, indicating that the task is terminated due to an OOM error and asking you to increase the sandbox memory size or click Run to run the task outside the sandbox.

Cause Analysis

In the sandbox isolation environment, you can customize the CPU and memory specifications of the sandbox using the sandbox.json configuration file. If the actual memory usage during task execution exceeds the configured upper limit, the system forcibly terminates the task due to an out-of-memory (OOM) error, resulting in an execution failure. Common scenarios include:

  • The amount of data to be processed is large, exceeding the current memory capacity.
  • A program or service with high memory usage is running in the task.
  • The sandbox memory specifications are too low to support the task load.

Solution

To address the preceding issue, you can refer to the two solutions below. The following table lists solution recommendations. Select a solution based on your actual situation.

Table 1 Solution recommendations

Comparison Item

Increasing Sandbox Memory Specifications

Switching to Non-sandbox Mode

Memory

Limited by the upper limit of sandbox specifications

No hard limit

Environment isolation

Sandbox isolation, secure and controllable

No isolation

Application scenario

Controllable task memory requirements, isolation required

High task memory requirements, secure and trusted content

Operation cost

Re-run required after configuration adjustment

One-click switch, effective immediately

Solution 1 is recommended to resolve the issue while maintaining the security of sandbox isolation. If the memory requirements exceed the sandbox specifications or if tasks need to be quickly restored, solution 2 can be used.

Solution 1: Increasing Sandbox Memory Specifications

Change the value of resources.memory in the sandbox.json configuration file to adjust the maximum sandbox memory.

  1. Log in to CodeArts Agent IDE by referring to Quick Start.
  2. Click in the upper right corner of CodeArts Agent IDE to open the settings page.
  3. In the navigation pane on the left, choose Chats.
  4. Choose Agents > Terminal Command Running Mode > Custom Sandbox Settings and click Open File to open the sandbox.json file.
  5. Change the value of resources.memory in the sandbox.json file.

    {
      "resources": {
        "cpu": 50,
        "memory": 4
      }
    }

  6. Save the configuration file and run the task again.

    If the OOM issue persists after the adjustment, check the task logic for potential memory leaks (for example, unreleased large objects or continuous data accumulation inside loops).

Solution 2: Switching to Non-sandbox Mode

Switch the agent's terminal command running mode to non-sandbox mode to remove sandbox memory restrictions.

  1. Log in to CodeArts Agent IDE by referring to Quick Start.
  2. Click in the upper right corner of CodeArts Agent IDE to open the settings page.
  3. In the navigation pane on the left, choose Chats.
  4. Under Agents, select Manual Running from the Terminal Command Running Mode drop-down list.

    In manual mode, the agent sends a confirmation prompt to you before executing any command. You need to manually confirm it.

    For security purposes, you are advised not to select Auto Running. In this mode, the agent bypasses all security checks and may perform high-risk operations without notification.