Rive CLI --publish: a file that imports a library with scripts fails script verification on the w...
Versions: Rive CLI 1.8.0, Rive Editor 0.9.462, @rive-app/webgl2 2.49.0. macOS on Apple silicon.
Build a project with rive . --publish when it imports a published library that contains Luau scripts (or a shader). None of the resulting .riv's scripts register on the web runtime. That includes the project's own scripts, not only the library's. Every scripted object logs:
ScriptAsset doesn't have a generator function <script name>A library shader logs:
Shader '<name>' is unavailable: its signature did not verify.The two controls work: the editor's Export > For Runtime of the same file runs, and a --publish build of a project that imports no scripted library runs. So the signing key is fine. The fault is in how the CLI lays out and signs a file whose scripts come from more than one source.
Steps to reproduce (verified 2026-10-30 with the files below; also in bugreport-cli-publish-repro/)
1. Library project (library/): one component artboard with one Luau Node script.
rive.yaml
name: repro-library
main: "Badge"scene.rml
<Rive version="1" kind="fragment">
<Artboard isComponent="true" width="200" height="200" styleId="0:4" name="Badge" id="0:2">
<LayoutComponentStyle id="0:4"/>
<ScriptedDrawable x="100" y="100" scriptAssetId="0:10" name="LibSquare" id="0:3"/>
</Artboard>
<ScriptAsset file="LibSquare.luau" scriptProtocolValue="node" name="LibSquare" id="0:10"/>
<ComponentAsset artboardId="0:2" name="Badge" id="0:11"/>
</Rive>LibSquare.luau (an orange square; the consumer's AppSquare.luau is the same script in blue)
type Square = { path: Path, paint: Paint }
function update(self: Square) end
function draw(self: Square, renderer: Renderer)
renderer:drawPath(self.path, self.paint)
end
return function(): Node<Square>
local path = Path.new()
path:moveTo(Vector.xy(-60, -60))
path:lineTo(Vector.xy(60, -60))
path:lineTo(Vector.xy(60, 60))
path:lineTo(Vector.xy(-60, 60))
path:close()
return {
path = path,
paint = Paint.with({ style = "fill", color = Color.rgb(255, 120, 40) }),
update = update,
draw = draw,
}
endThen run these CLI commands in a terminal:
cd library
rive push . --yes --project=<project id> # first push creates the file
rive library publish . --yes
rive library info --library=<library id> # note the version id and the snapshot id2. Consumer project (consumer/): the library's component placed next to one script of its own. Put the ids from rive library info into the LibraryAsset.
scene.rml
<Rive version="1" kind="fragment">
<Artboard width="400" height="200" styleId="0:4" name="Main" id="0:2">
<LayoutComponentStyle id="0:4"/>
<NestedArtboard artboardId="0:20" x="0" y="0" name="LibraryBadge" id="0:5"/>
<ScriptedDrawable x="300" y="100" scriptAssetId="0:10" name="AppSquare" id="0:3"/>
</Artboard>
<ScriptAsset file="AppSquare.luau" scriptProtocolValue="node" name="AppSquare" id="0:10"/>
<LibraryAsset libraryId="LIBRARY_ID" libraryVersionId="LIBRARY_VERSION_ID" assetId="SNAPSHOT_ID" name="repro-library" id="0:19">
<LibraryArtboard name="Badge" componentId="0:2" groupId="0:19" id="0:20"/>
</LibraryAsset>
</Rive>Then run this:
cd consumer
rive push . --yes --project=<project id> # creates the file
rive pull . --yes # downloads the library snapshot into .libraries/
rive . --publish --output-dir=out # logs "signing 2 scripts"3. Load out/repro-consumer.riv with @rive-app/webgl2 2.49.0 (any page with new Rive({ src, canvas, autoplay: true, artboard: "Main" })).
Result: the console shows
ScriptAsset doesn't have a generator function LibSquare
ScriptAsset doesn't have a generator function AppSquare
and neither square draws. The consumer's own script fails along with the library's.
Controls:
Library alone: rive . --publish in library/ gives a file whose script runs (0 errors).
No import: remove the NestedArtboard and the LibraryAsset from the consumer and build again. AppSquare runs (0 errors).
Editor export: Export > For Runtime of a consumer file runs. This was observed on a larger consumer file that imports eight libraries (below), and has not been repeated on this two-project file.
What the three files contain (each payload is one script's bytecode; key 911 is the signature):
Consumer, --publish: 3 payloads (LibSquare from the library, AppSquare, and .libraries/repro-library@<snapshot>/LibSquare) and 1 signature, after all three. The runtime check fails: the signature covers the two "own" payloads only.
Library alone, --publish: 1 payload and 1 signature. The runtime check verifies.
Consumer without the import: 1 payload and 1 signature. The runtime check verifies.
Shader variant (not in the two-project files): in the larger file, a library shader also logged "Shader '' is unavailable: its signature did not verify".
The same failure in a larger file
The comparison below is the editor export and the CLI --publish build of the same consumer file. The consumer imported eight libraries carrying 43 script and shader payloads, plus 2 scripts of its own.
Script and shader payloads: 45 in the editor export, 88 in the CLI --publish build (43 library + 45 "own").
Signatures (FileAssetContents key 911): 8 in the editor export (one per imported library that carries scripts, plus one for the file's own scripts), 1 in the CLI build, on the last payload.
File size: 1.38 MB for the editor export, 2.46 MB for the CLI build.
Web runtime 2.49.0: the editor export runs; in the CLI build every scripted object fails.
The 43 library payloads in the CLI build are byte-identical to the editor's. They are written without the library's signature, though, and they land in the same verification block as the CLI's own payloads.
Every library source is also compiled a second time as one of the file's own scripts, named .libraries/<library>@<snapshot>/<script>. Those copies are byte-identical to the library payloads. They double the bytecode. excludeFromRev: scripts: [".libraries/*"] removes them from rive push but has no effect on --publish.
Why it fails (runtime behavior)
Each in-band script or shader payload, minus its header (1 byte, or 65 when flags & 0x80), is added to a verification set.
The next FileAssetContents that carries a signature (key 911) closes the block. The runtime concatenates every payload collected since the previous signature and checks it with libhydrogen: hydro_sign_verify(sig, msg, len, "RiveCode", g_scriptVerificationPublicKey).
Every payload in the block gets that one result. Only verified scripts are registered with the VM; anything else fails later with "doesn't have a generator function".
So one payload in a block that the block's signature does not cover fails every script in that block.
(Read in rive-runtime at a5e6bcf17, src/importers/script_asset_importer.cpp, and in the August 2026 sources, where it moved to src/importers/text_asset_importer.cpp. The shader message is not in either of those revisions; that shaders join the same blocks is what 2.49.0 does, observed in step 8.)
What the CLI's single signature covers
The signature was checked against candidate messages with libhydrogen and the runtime's public key and context:
Every payload in file order (what the runtime checks): does not verify.
The CLI's own payloads in file order: does not verify.
The CLI's own payloads in file order, with each library shader moved to right after that library's scripts: verifies.
So there are two defects:
Library payloads lose their signatures. The CLI signs only its own payloads, so the library payloads sitting in the same block can never verify. This alone breaks a consumer whose libraries have no shader: its signature verifies over its own payloads, but the runtime's block also contains the unsigned library payloads.
Shaders are signed in a different position from where they are written. The CLI signs each source's scripts followed by its shaders, but writes the shader asset elsewhere. A consumer of a library with a shader therefore fails even over its own payloads.
The signatures change from build to build (libhydrogen signatures are randomised), but the payload order is identical on every run.
Expected
A --publish build of a consumer file verifies the way the editor's export does:
each imported library's payloads carry the signature from the published library version, in a block of their own;
the file's own scripts are in a block of their own, signed in the order they are written;
library sources are not emitted a second time as the file's own scripts.
Suggested fixes (CLI)
Write each library version's signed payloads together with its signature (key 911), as the editor does, closing each library's block before the file's own payloads begin. A downloaded library snapshot holds only markup and .luau sources, so the CLI needs the published bytecode and signature, or must sign each library group itself.
Sign in write order: build the signed message from the payloads exactly as they are serialized, shaders included.
Skip .libraries/** when collecting the project's own scripts and shaders (or honour excludeFromRev for --publish too).
On the runtime side, it would help to report which verification block failed, instead of only the downstream "doesn't have a generator function".
Current Workaround
Build and update with the CLI (rive library publish, rive library update, rive push), then produce the shipping .riv with the editor's Export > For Runtime. An editor tab that was open during a rive push keeps showing the previous revision until it is reloaded, so reload it before exporting.
bugreport-cli-publish-repro.zip