“script stopped after 2000 ms (infinite loop?)” in Senzoukria scripting
Every Senzoukria script runs in a sandboxed worker with a budget of 2 seconds per run. A script that exceeds it is stopped with “script stopped after 2000 ms (infinite loop?)”; a sandbox that never started reports a different message.
Senzoukria · Troubleshooting · Updated September 2026
At a glance
- Timeout
- “script stopped after {ms} ms (infinite loop?)”
- Budget
- 2,000 ms per run
- Sandbox not served
- “sandbox unavailable: the {scheme} protocol served nothing within {ms} ms (app launched outside Tauri?)”
- Effect
- The chart keeps running; the script run returns an error
What you see
The script console and the pipeline strip show the run as failed with “script stopped after 2000 ms (infinite loop?)”. If the sandbox never answered at all, the error is “sandbox unavailable: the {scheme} protocol served nothing within {ms} ms (app launched outside Tauri?)”.
Why it happens
Scripts run in one sandboxed worker with no network, no file access and no broker API. A run that does not answer within its budget is stopped so a broken script cannot freeze the chart. Most often the cause is a loop that never ends, or a loop over all bars nested inside another loop over all bars. The two failures are kept apart on purpose: for two and a half months, a sandbox that did not start had been read as a slow script. Starting the Python engine is timed separately and is not counted in the 2-second budget.
How to fix it
- Look for while loops whose exit condition can stay false, and for a counter that is never updated.
- Replace nested loops over all bars with a single pass that carries running values.
- Test on a shorter chart range to see whether the time grows with the number of bars.
- Use the Script assistant: it can run the script, read the real error and propose a fix.
- For the sandbox message, restart the app; it indicates the sandbox protocol did not serve anything.
What it is not
- Not a crash of the app: a broken script never kills the chart.
- Not a syntax error: those point to a line (“Failed at line {line}”).
When to contact support
Still stuck after these checks? Use Menu → Report a problem, or post on the Senzoukria Discord. Attach a minimal script that reproduces the stop and say on which chart and timeframe it runs.
Related pages
In the same section
- Sign in in the main window
- Connect needs a saved password
- Credentials not saved
- Replay load refused (rp_code 13)
- News source rate-limited
- Order book feed stopped
- Import stopped: memory limit
- NT misconfigured banner
This page in other languages
Frequently asked questions
- Is the 2-second budget per bar or per run?
- Per run. The C++ toolchain lists the same limit: 2 s per run, with the 256 most recent bars per call.
- Do Python scripts have the same budget?
- Their execution follows the same sandbox rules; only the start-up of the Python engine is timed outside the 2-second budget.