Limits and errors
Every limit Rin Chat enforces on an extension, and every error code it can see or cause. rinext test runs
the same code with the same numbers, so a limit you hit in the app you hit in a test.
Characters are UTF-16 code units (JavaScript's length) unless a limit says bytes.
The sandbox
| Limit | Value |
|---|---|
| Interpreter heap | 32 MB |
| Interpreter memory in all (hard cap) | 64 MB |
| Interpreter stack | 96 KB |
| CPU per hook call | 100 ms of interpreter time (waiting on rin.* answers does not count) |
| CPU to load the script (its top level) | 500 ms |
| Wall clock to load | 3000 ms |
| Entry script | 2 MiB |
| One payload, either direction (arguments, results, hook arguments and return values) | 1,048,576 characters of JSON |
| Nesting in a payload | 64 levels |
| Keys refused anywhere in a payload | __proto__, constructor, prototype |
rin.* calls in flight at once | 32 |
Deep recursion and deeply nested JSON.parse or JSON.stringify can overflow the host's stack; that ends the
call with crashed.
Hook deadlines
| Hook | Wall clock |
|---|---|
onChatOpen, onBeforeAssemble, onReply, onTest | 1000 ms |
onAssembled, onReplyDone | 1000 ms shared by every extension, in turn |
onChatClose | 300 ms |
onCommand, onWidget, onPanel | 1000 ms; 60 s for an extension with model.run; paused while a dialog it opened waits on the user |
onMacro | 200 ms per macro, 1000 ms for all of them |
onRender | 300 ms per message per extension |
Chat, prompt and model
| Call | Limits |
|---|---|
chat.read | The newest messages that fit about 600,000 characters |
chat.vars.set | 1 to 32 names per call; name [A-Za-z_]\w{0,40}; string values at most 4000; no lore_, roster_, adv_npc_, adv_dm_ names; 8 calls per hook call |
chat.send | 1 to 8000 characters; 2 per hook call; 6 per 60 seconds per chat |
chat.generate | 1 per hook call; 1 request of the daily budget each |
prompt.inject | 1 to 8000 characters; depth 0 to 1000; 4 per extension per turn; 4 queued |
prompt.rewrite | 1 to 2000 messages, each at most 400,000 characters |
prompt.macro | Name [a-z][a-z0-9_]{0,31}; 16 per extension; value at most 4000 characters |
reply.transform | At most 400,000 characters |
onRender | Messages up to 100,000 characters; 20 uncached messages per pass |
model.run | 1 to 64 messages, each at most 100,000, at most 400,000 in all; maxTokens 1 to 4096 (default 512); temperature 0 to 2 |
model.run budget | Per extension per day: 20 requests and 20,000 tokens by default; the user may set up to 10,000 requests and 10,000,000 tokens |
gen.params | See the bounds table in the API reference |
UI
| Call | Limits |
|---|---|
ui.command | Name [a-z][a-z0-9_]{0,31}; description at most 120; 16 per extension; not continue, impersonate, image, img, sd |
ui.panel | Title at most 60; 40 items; text 500; meter label 40; list 20 items of 200; button and toggle ids [a-z0-9_-]{1,32}, labels 1 to 40; table 12 rows of 1 to 6 cells of 100 |
ui.hud | 6 items; key [a-z0-9_]{1,32}; label 1 to 24; value 24 |
ui.annotate | back 0 to 1000; text 2000 (a badge: one line of 40); title 40; 50 notes per extension |
ui.choices | 6 choices; label 1 to 40; text 1 to 2000 |
ui.notify | One line, 1 to 200; 3 per 20 seconds per chat |
composer.draft | 8000 |
ui.style, ui.partStyle | 65,536 characters each; z-index auto or an integer up to 99999 |
ui.theme | Name 1 to 40; hex colors; 3:1 contrast for --foreground and --muted |
audio.play | .wav, .ogg, .mp3; 1 MiB each; 4 at once; volume 0 to 1 |
voice.speak | 1 to 2000; 6 per minute per chat |
dice.roll | Expression 1 to 64; up to 100 dice of up to 1000 sides per term |
text.tokens | 400,000 |
Storage, settings, logs
| Thing | Limits |
|---|---|
| Storage key | 1 to 128 bytes, no control characters, not starting rin: |
| Storage value | 256 KiB of JSON |
| Storage in all | 1 MiB (keys plus values), 1024 keys |
| Settings form | 32 fields; see The manifest |
| Extension log | Lines cut at 2000 characters; 500 kept |
| Network log | 200 entries kept |
Network
| Limit | Value |
|---|---|
Declared hosts (net) | 32 |
| Methods | GET, HEAD, POST, PUT, PATCH, DELETE |
| URL | 8192 characters |
| Headers | 32; names 64; values 4096 of visible ASCII |
| Request body | 64 KiB (UTF-8); none on GET or HEAD |
| Response body | 512 KiB |
| Timeouts | 10 s to connect, 20 s in all |
| Rate | A burst of 5, refilling at 15 per minute, per extension |
| Denials in a row before the extension is blocked in that chat | 3 |
| A review left unanswered expires after | 10 minutes |
Package
| Limit | Value |
|---|---|
.rinext file, and its contents inflated | 2 MiB each |
| Entries | 64, SIGNATURE included |
| File name | 128 bytes, 4 segments |
manifest.json | 64 KiB |
| Sound file | 1 MiB |
Error codes a call rejects with
The message of the RinError a rin.* call rejects with.
| Code | Meaning |
|---|---|
denied | The manifest lacks the permission, the call does not exist, the call reaches a chat the user has left, or it is not allowed from this hook (open.url outside a user-started hook; anything but log inside onMacro; most calls inside onTest) |
bad_request | Arguments of the wrong shape or past a limit, a call with nothing to act on, or text a rule refuses (a web address in a post, a transform that adds a directive, a theme with unknown tokens or poor contrast) |
too_large | A payload over 1,048,576 characters, or a storage value over 256 KiB |
bad_value | Not plain JSON, nested deeper than 64, or a banned key |
too_many_requests | 32 calls in flight, or a call's own rate limit (chat.vars.set, chat.send, ui.notify, voice.speak, audio.play) |
quota | A storage write past 1 MiB or 1024 keys |
budget | model.run or chat.generate past today's budget |
no_model | model.run with no model picked for the extension, or a pick that cannot be used |
model_failed | The provider failed, or the call was cut off at the hook's deadline |
net_blocked | Network Blocked for this extension, "Block network for all extensions" on, or three denials in a row in this chat |
net_needs_approval | A turn hook asked for a host the user has not allowed |
net_denied | The user denied the request |
net_refused | A rule refused it before it went (the network log says which) |
net_failed | It went and failed: DNS, connection, timeout, response too large |
net_rate_limited | Past the network rate |
Why a hook call failed
Not seen by the script; Rin Chat records these, and they count toward the failure pause (see
Hooks). rinext test lists them in chat.errors.
| Code | Meaning |
|---|---|
threw | The hook threw or its promise rejected (with the error's message) |
timeout | Past the hook's wall clock; the interpreter is stopped |
cpu | Past the CPU budget; the interpreter is stopped |
memory | Past the memory cap; the interpreter is stopped |
crashed | The interpreter trapped (for example a native stack overflow); it is stopped |
bad_value, too_large | The return value was not plain JSON, or too large |
not_loaded | The script failed to load |
no_hook | The extension did not register that hook (not a failure) |
killed | Rin Chat stopped the instance on purpose, for example the chat closed (not a failure) |
Why a package is refused
What rinext pack and rinext check print, and what the install dialog says, by code.
| Code | Sentence |
|---|---|
too_large | The extension is larger than 2 MB. |
not_zip | This is not an extension package (.rinext). |
bad_name | The package holds a file whose name is not allowed: <name>. |
duplicate_file | The package holds the same file twice. |
too_many_files | The package holds too many files. |
unexpected_file | The package holds a kind of file extensions may not carry: <name>. |
extra_script | The package holds a second script (<name>); an extension is one bundled script. |
no_manifest | The package has no manifest.json. |
bad_manifest | The package's manifest.json is not valid. |
bad_id | The extension's id is not valid. |
bad_field | The manifest's <field> field is not valid. |
bad_version | The extension's version is not a valid version number. |
bad_entry | The manifest's entry script is missing or is not text. |
bad_permission | The extension asks for a permission this version of Rin Chat does not know: <name>. |
bad_host | The extension names a network host that is not allowed: <host>. |
bad_key | The manifest's author key is not valid. |
bad_setting | The extension's settings form is not valid: <key or position>. |
bad_audio | The package holds a sound that is not a WAV, OGG or MP3 file of at most 1 MB: <name>. |
unsigned | The package is not signed by its author. |
bad_signature | The package's signature does not match its contents. |
key_changed | This extension is signed by a different author than the one you installed before, so it was refused. |
exists | An extension with this id is already installed from another source. |
pinned | Data kept from a removed extension with this id belongs to its author. Remove it with its data first. |
changed | The extension's files changed after they were checked, so it will not run. |
And why an installed extension does not run:
| Code | Sentence |
|---|---|
all_off | All extensions are turned off. |
safe_mode | Rin Chat started in safe mode, so extensions are off until the next start. |
any_source_off | Turn on Trust extensions from any source first. |
dev_mode_off | Turn on Developer mode first. |
locked | Rin Chat is locked, so no extension can run. |
revoked | AICC withdrew this version: <reason> |
reg_stale | Rin Chat has not checked AICC's list of withdrawn extensions for 30 days. |
reg_unattested | This extension's AICC review record is missing, so it will not run. Install it again from AICC. |