Skip to content

stateLoadFile on a missing path aborts the Wasm core #116

Description

@leehack

After a model loads, stateLoadFile on a path that does not exist aborts the Wasm core instead of rejecting:

await bridge.stateLoadFile('/does_not_exist.bin', 512);
// main thread: RuntimeError: Aborted(undefined). Build with -sASSERTIONS for more info.
// worker: Error with the same text, and the bridge moves to the main thread for the session

It behaves the same on v0.1.44 and v0.1.47, in main-thread and worker modes, on wasm32 and wasm64.

llamadart_webgpu_state_load_file (src/llama_webgpu_core.cpp:1652 at 64ba825) passes the path straight to llama_state_load_file. Its own failure branch, which returns -5 with "Failed to load llama.cpp state file…", is never reached.

This matters because Web state paths are virtual and do not survive a page reload. So loading a path saved before a reload hits this.

Expected: a missing file rejects with an error, for example by checking that it exists first and returning a new code, and leaves the runtime usable.

Found while validating the bridge pin bump in leehack/llamadart#620.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority:P2Important improvement or regression; schedule next

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions