cap_memory
What happened
A script runs with a limit on the memory it may use. When it goes over, the sandbox stops it and answers with this code. detail names the cap that tripped (mem_mb), how much the script used and how much was allowed. The caps differ for a chart and for a run, and the code sandbox section of the Limits page lists them.
What to do
Keep fewer values alive at once: build one series at a time, and drop intermediate lists and tables you no longer use.
Example
json
{
"request_id": "7d2b1c44-95a0-4e3b-8a6f-1c0d9e2f5a37",
"ok": false,
"error": {
"code": "cap_memory",
"message": "The script used more memory than allowed.",
"detail": {
"cap": "mem_mb",
"used": 560,
"allowed": 512
}
}
}