ReferenceReference

Limits and errors

Reference Sugar limits for variables, programs, lists, objects, results, Apps, embeds, and dice, plus common error fixes.

Sugar limits keep public creations fast, predictable, and safe. The editor stays lightweight while you type. JOI compiles and checks the complete program in Sandbox Mode or when the creation actually runs.

Authoring limits

ResourceLimit
Variables on an Item, Item action, or Boop50
Options on a choice variable50
Variable or media name32 characters
String variable value2,000 characters
Read-only expression2,000 characters
Program16,000 characters
Functions per Item, Boop, or App50
Mixins per App50
Parameters per function, mixin, or embed20
Sugar text pool50 entries
Media Pools per App, Item, or Boop50
Candidates per Media Pool50
Item custom actions10
Item action description80 characters
App Main module172,000 characters
Boop Code module212,000 characters
Item Code module252,000 characters
App Automations module45,000 characters
Media Library100 resources
Local Embed Templates50
Session declarations per App20
Interaction declarations per module50
Interactive components per message5

Program limits

BehaviorLimit
Instructions across a program and its if and match branches100
Creator function calls during one run100
Operations during one run1,000
Generated output16,000 characters
Custom chips per use20
Custom chip text80 characters
Displayed embeds per use3
Dice calls per program10
Dice rolled across one program50

A single dice expression may roll up to 10 dice using d2, d4, d6, d8, d10, d12, or d20. Dice modifiers may not exceed 1000 in magnitude.

Creator functions cannot use direct or indirect recursion.

Collection limits

BehaviorLimit
Collection nesting5 levels
Entries in one list100
Properties in one object100
Values in one range100
Serialized collection value16,000 characters

Collections may contain text, numbers, booleans, None, lists, and objects.

Embed limits

ResourceLimit
Saved templates per App, Item, or Boop50
Highlighted embeds per Item2
Compiled template program16,000 characters
Fields per embed10
Title256 characters
Description2,000 characters
Footer256 characters
Field title256 characters
Field text1,000 characters

Banner, thumbnail, and field icon media must resolve to named images, not videos or arbitrary URLs.

Chip limits

ResourceLimit
Named chips per module or action50
Highlighted chips per Item8
Chips shown by one program20
Chip text80 characters

App limits

ResourceLimit
Apps per account3
Variables per App50
Named media entries per App100
Embed Templates per App50
Automations per App10
App or Automation name80 characters
Automation program16,000 characters
Manual Automation cooldown5 minutes
Seats per Session6
Current Sessions per JOI3

A chat and a host Item can each belong to one current Session. A lobby expires after one hour if it never starts. An active Session expires after 24 hours without activity. Standalone message interactions expire after one hour; interactions belonging to a Session live with that Session.

Apps require account Plus.

Libraries produced while migrating older per-action media keep every resource even when the combined result exceeds the normal Media Library limit. New uploads remain unavailable until the library is brought below that limit.

Common errors

Unknown variable

Check spelling and capitalization. Add $ for App variables.

Cannot be assigned

This type of code cannot change the variable. Common examples are const declarations, Item objects, and App variables outside the Automation’s selected scope.

Unexpected statement

Check for a missing semicolon, unmatched { }, or an if, else if, or else branch without braces. Value-producing conditionals still require both then and else.

Expected a list

A one-entry list needs a trailing comma:

({ title: "Score", text: score },)

Media does not exist

Check the exact name and confirm that the media is available to the Item, Boop, or linked App. Embed image properties require an image, not a video.

Function cannot be used here

Conditions and templates cannot change outside variables. Automations cannot add message content or use functions that require confirmation.

Item changed before use

The inventory or Item changed while the confirmation screen was open. Run the action again so JOI can use the latest values.

Not enough Lore

The available balance cannot cover every requested payment. Sugar includes earlier charges and transfers from the same program when checking the balance.