Open beta. Rin Chat is under active development. Expect rough edges, and please tell us what breaks.

Skip to content
Extension guide contents

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

LimitValue
Interpreter heap32 MB
Interpreter memory in all (hard cap)64 MB
Interpreter stack96 KB
CPU per hook call100 ms of interpreter time (waiting on rin.* answers does not count)
CPU to load the script (its top level)500 ms
Wall clock to load3000 ms
Entry script2 MiB
One payload, either direction (arguments, results, hook arguments and return values)1,048,576 characters of JSON
Nesting in a payload64 levels
Keys refused anywhere in a payload__proto__, constructor, prototype
rin.* calls in flight at once32

Deep recursion and deeply nested JSON.parse or JSON.stringify can overflow the host's stack; that ends the call with crashed.

Hook deadlines

HookWall clock
onChatOpen, onBeforeAssemble, onReply, onTest1000 ms
onAssembled, onReplyDone1000 ms shared by every extension, in turn
onChatClose300 ms
onCommand, onWidget, onPanel1000 ms; 60 s for an extension with model.run; paused while a dialog it opened waits on the user
onMacro200 ms per macro, 1000 ms for all of them
onRender300 ms per message per extension

Chat, prompt and model

CallLimits
chat.readThe newest messages that fit about 600,000 characters
chat.vars.set1 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.send1 to 8000 characters; 2 per hook call; 6 per 60 seconds per chat
chat.generate1 per hook call; 1 request of the daily budget each
prompt.inject1 to 8000 characters; depth 0 to 1000; 4 per extension per turn; 4 queued
prompt.rewrite1 to 2000 messages, each at most 400,000 characters
prompt.macroName [a-z][a-z0-9_]{0,31}; 16 per extension; value at most 4000 characters
reply.transformAt most 400,000 characters
onRenderMessages up to 100,000 characters; 20 uncached messages per pass
model.run1 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 budgetPer 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.paramsSee the bounds table in the API reference

UI

CallLimits
ui.commandName [a-z][a-z0-9_]{0,31}; description at most 120; 16 per extension; not continue, impersonate, image, img, sd
ui.panelTitle 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.hud6 items; key [a-z0-9_]{1,32}; label 1 to 24; value 24
ui.annotateback 0 to 1000; text 2000 (a badge: one line of 40); title 40; 50 notes per extension
ui.choices6 choices; label 1 to 40; text 1 to 2000
ui.notifyOne line, 1 to 200; 3 per 20 seconds per chat
composer.draft8000
ui.style, ui.partStyle65,536 characters each; z-index auto or an integer up to 99999
ui.themeName 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.speak1 to 2000; 6 per minute per chat
dice.rollExpression 1 to 64; up to 100 dice of up to 1000 sides per term
text.tokens400,000

Storage, settings, logs

ThingLimits
Storage key1 to 128 bytes, no control characters, not starting rin:
Storage value256 KiB of JSON
Storage in all1 MiB (keys plus values), 1024 keys
Settings form32 fields; see The manifest
Extension logLines cut at 2000 characters; 500 kept
Network log200 entries kept

Network

LimitValue
Declared hosts (net)32
MethodsGET, HEAD, POST, PUT, PATCH, DELETE
URL8192 characters
Headers32; names 64; values 4096 of visible ASCII
Request body64 KiB (UTF-8); none on GET or HEAD
Response body512 KiB
Timeouts10 s to connect, 20 s in all
RateA burst of 5, refilling at 15 per minute, per extension
Denials in a row before the extension is blocked in that chat3
A review left unanswered expires after10 minutes

Package

LimitValue
.rinext file, and its contents inflated2 MiB each
Entries64, SIGNATURE included
File name128 bytes, 4 segments
manifest.json64 KiB
Sound file1 MiB

Error codes a call rejects with

The message of the RinError a rin.* call rejects with.

CodeMeaning
deniedThe 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_requestArguments 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_largeA payload over 1,048,576 characters, or a storage value over 256 KiB
bad_valueNot plain JSON, nested deeper than 64, or a banned key
too_many_requests32 calls in flight, or a call's own rate limit (chat.vars.set, chat.send, ui.notify, voice.speak, audio.play)
quotaA storage write past 1 MiB or 1024 keys
budgetmodel.run or chat.generate past today's budget
no_modelmodel.run with no model picked for the extension, or a pick that cannot be used
model_failedThe provider failed, or the call was cut off at the hook's deadline
net_blockedNetwork Blocked for this extension, "Block network for all extensions" on, or three denials in a row in this chat
net_needs_approvalA turn hook asked for a host the user has not allowed
net_deniedThe user denied the request
net_refusedA rule refused it before it went (the network log says which)
net_failedIt went and failed: DNS, connection, timeout, response too large
net_rate_limitedPast 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.

CodeMeaning
threwThe hook threw or its promise rejected (with the error's message)
timeoutPast the hook's wall clock; the interpreter is stopped
cpuPast the CPU budget; the interpreter is stopped
memoryPast the memory cap; the interpreter is stopped
crashedThe interpreter trapped (for example a native stack overflow); it is stopped
bad_value, too_largeThe return value was not plain JSON, or too large
not_loadedThe script failed to load
no_hookThe extension did not register that hook (not a failure)
killedRin 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.

CodeSentence
too_largeThe extension is larger than 2 MB.
not_zipThis is not an extension package (.rinext).
bad_nameThe package holds a file whose name is not allowed: <name>.
duplicate_fileThe package holds the same file twice.
too_many_filesThe package holds too many files.
unexpected_fileThe package holds a kind of file extensions may not carry: <name>.
extra_scriptThe package holds a second script (<name>); an extension is one bundled script.
no_manifestThe package has no manifest.json.
bad_manifestThe package's manifest.json is not valid.
bad_idThe extension's id is not valid.
bad_fieldThe manifest's <field> field is not valid.
bad_versionThe extension's version is not a valid version number.
bad_entryThe manifest's entry script is missing or is not text.
bad_permissionThe extension asks for a permission this version of Rin Chat does not know: <name>.
bad_hostThe extension names a network host that is not allowed: <host>.
bad_keyThe manifest's author key is not valid.
bad_settingThe extension's settings form is not valid: <key or position>.
bad_audioThe package holds a sound that is not a WAV, OGG or MP3 file of at most 1 MB: <name>.
unsignedThe package is not signed by its author.
bad_signatureThe package's signature does not match its contents.
key_changedThis extension is signed by a different author than the one you installed before, so it was refused.
existsAn extension with this id is already installed from another source.
pinnedData kept from a removed extension with this id belongs to its author. Remove it with its data first.
changedThe extension's files changed after they were checked, so it will not run.

And why an installed extension does not run:

CodeSentence
all_offAll extensions are turned off.
safe_modeRin Chat started in safe mode, so extensions are off until the next start.
any_source_offTurn on Trust extensions from any source first.
dev_mode_offTurn on Developer mode first.
lockedRin Chat is locked, so no extension can run.
revokedAICC withdrew this version: <reason>
reg_staleRin Chat has not checked AICC's list of withdrawn extensions for 30 days.
reg_unattestedThis extension's AICC review record is missing, so it will not run. Install it again from AICC.