Timill Platform Documentation

Limits and errors

The time, memory and API-call budgets of each kind of script, and how failures are reported.

Every script runs in a sandbox with a fixed budget. Exceeding any part of it stops the run.

Limits#

TimeAPI callsMemory
Backend scripts — manual, scheduled, event, item menu30 s10050 MB
Save hooks5 s10050 MB
Scripted charts and scripted widgets10 s5025 MB

Time is wall-clock time for the whole run, including the time spent waiting on fetch. Memory is sampled while the script runs, so treat the figure as a ceiling, not an exact allowance.

Only fetch() and secrets.get() count as API calls. Reading data — group.queryItems, getField, getMembers — and writing it — setField, createItem, addComment — do not.

Files have their own cap: a script can read or attach files of up to 10 MB, and a fetch response may be up to 10 MB. See Files and attachments.

Tip

One broad query is cheaper and faster than many narrow ones: fetch the items once with group.queryItems, then group and count them in memory with api.groupBy / api.aggregate or plain loops.

A save hook runs inside the save a person is waiting on, so its time budget is 5 seconds whatever the script’s own limit. A hook that runs out of time fails like any other: its changes are dropped and the save still succeeds. Keep hooks short, and move slow work — calls to external services especially — to an event script, which runs in the background.

How errors surface#

Where the script runsWhere you see a failure
Manual runthe script list shows the run’s status; output and log lines are in the execution history
Scheduled and event scriptsthe execution history
Save hookthe execution history; the person’s save still succeeds without the hook’s changes
Item menu scripta notification to the person who ran it, and the execution history
Scripted chart or widgetan error box in the tile, visible to the viewer, and the widget’s Recent runs

The execution history keeps, for every backend run, its status (success, failed, timeout, cancelled), duration, output, error and the lines written with log(). Open it from the script’s page in group administration.

A scripted chart or widget runs as each person who views it, so every render is its own run. Its Recent runs — under the code editor in the widget’s configuration — list each run’s status, duration, the error the tile showed and the lines written with log(), with the name of the person it ran as. You see your own runs; the group’s administrators see everyone’s, which is how you find out why a chart fails for one viewer and not for you.

Errors in JavaScript#

KindWhat happens
Syntax errorthe script cannot be saved
An uncaught exception — throw, calling something that does not existthe run stops and fails with the message and line
A failed write — setField, createItem, addAttachment, …nothing throws: the method returns {success: false, error}, and the run continues
A malformed query in group.queryItemsthrows, with the parser’s explanation
readAttachment on a file that is not on the itemthrows
fetch network failurethrows; an HTTP error status does not — check r.ok
A limit exceededthe run stops with a limit error

Because writes do not throw, check the result where a failure matters:

const r = item.setField("approvedBy", userId);
if (!r.success) {
  log("could not record approval:", r.error);
}

Use try/catch around code that can throw when the rest of the run should continue:

let items = [];
try {
  items = group.queryItems(pageVars.get("filter") || "");
} catch (e) {
  log("bad filter:", e.message);
}

Errors in Gonja templates#

A template that fails to parse, calls an unknown function, runs a malformed query or reads a file that is not on the item stops rendering, and the tile shows the error. Missing values do not fail: an unset field or variable renders as an empty string, and date() / datetime() print nothing for an unset date.

Debugging#

  • log(...) writes lines to the execution history, next to the script’s final value; it accepts any value and prints objects as JSON.
  • Running a script manually and opening its execution log shows the final value and every log() line — the quickest way to try a query or a transformation before wiring the script to a trigger.
  • Write methods say why they failed — log r.error.
  • Permissions apply to scripts: a query returns only what the script’s user may see, a field that user’s roles hide reads as unset, and a write to a field that user cannot edit is refused. See Backend scripts for which user each trigger runs as.