ChartnautDocs

Budget exceeded

A budget error means the script did more work than Chartnaut allows for one run, so it was stopped to keep the chart or the study responsive. The message names the budget and gives the observed number against the limit. Find the budget below and apply its fix.

On the chart

An indicator or definition that goes over a budget shows stopped on its row in the chart legend. The tooltip reads "<name> stopped to keep the chart responsive", then <kind> exceeded: <observed> / <limit> <unit>, the bar it stopped on, and a remedy.

Budget

Limit

Usual cause

Fix

run_wall_clock

warns at 2 s, stops at 30 s per calculation

Too much history, or heavy work on every bar.

Declare less history. Move heavy work into a higher-timeframe handler that runs once per bucket.

handler_wall_clock

5 s in one onBar or handler call

A loop over every price tick on every bar.

Step by the instrument's tick size or a row-size setting, not 0.01.

loop_iterations

350,000 per call; 2 million to 50 million per run, scaled by bar count

Nested loops, or a fine price step on a high-priced symbol such as BTC.

Process each higher-timeframe bucket once. The lint warns early with workload/fine-price-step.

ctx_calls

500,000 per call

Painting or accumulating inside a loop.

Compute in the loop, then call ctx.plot or ctx.accum once.

indicator_points

warns at 500,000, stops at 2,000,000

Many outputs on a long history.

Plot on transitions only, or drop outputs.

emitted_events

warns at 25,000, stops at 100,000

A condition that is true on most bars.

Tighten the condition, or declare oncePer on the event.

accum_slots

warns at 256, stops at 1,024

A new ctx.accum id per bar or per level.

Reuse a fixed set of ids and keep collections inside one slot.

lifecycle_instances

warns at 2,500, stops at 10,000

Every bar adds a range or line that never ends.

Declare expires, or use mode: "replace" for rolling zones.

layer_rows

warns at 5,000, stops at 20,000 rows per layer

One row per bar.

Key one row per session or per zone, and seal and remove old rows.

layer_bytes

warns at 4 MB, stops at 32 MB per layer

Fine bins or grid steps.

Coarsen the step or shrink float32array fields.

warmup_replay

warns at 2.5 s, stops at 10 s

A large warmup with arrays built in the handler.

Lower the warmup, or keep running sums instead of arrays.

Layers have one more budget. When paint takes more than 4 ms for three frames running, the layer pauses with "frame budget exceeded". Draw at most one shape per pixel row: merge bins shorter than 1 px, skip labels in small cells, or move dense cells to paintGL.

still processing on the row is not a budget error. It means one calculation has run past 2 seconds and is still going.

In a study run

A study run that fails shows one error kind and a request ID.

Kind

Limit

Fix

script_execution_timeout

15 s for one event; also onFinish and startup

Do less in onEvent: shorter ctx.candles.forward windows, fewer dependency reads, return early for events you skip.

too_many_event_timeouts

10 event timeouts in one run

Same as above. One slow branch usually causes all of them.

budget_wall_clock

10 minutes for the whole run

Use a shorter date range or fewer declared definitions and indicators.

memory_limit

the worker's memory

Use a shorter range and collect smaller values.

budget_total_events

100,000 events

Use a shorter range or a more selective definition.

budget_emitted_events

100,000 events from one definition

Tighten the definition's condition.

budget_collected_rows

100,000 rows per key, 500,000 in total

Collect aggregates in onEvent, not raw series.

budget_forward_bars

5,000 bars in one forward scan

Shorten the forward window.

budget_payload

the published results' size

Publish fewer or smaller results; never publish a full series.

budget_annotations

10,000 chart annotations

Mark fewer events.

budget_call_stack

1,024 nested calls

Replace recursion with a loop.

Iterate on less

While you fix the script, run it on a short range: a few weeks on the chart, one month for a run over history or a study. Widen the range once the run is fast.

Budgets cost nothing and have nothing to do with AI credits. A lost broker connection is not a budget error either.

All limits and every other error code are in Lint and error codes. Plan-based history limits are on Budgets and limits.