You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Wrapper: catch C++ exceptions at the C ABI so a llama.cpp throw is an error, not a process abort #102
llama_dart_sampler_sample (and the other guarded wrapper calls) forward straight to llama.cpp with no exception barrier. When llama.cpp throws — e.g. std::runtime_error: Unexpected empty grammar stack after accepting piece from llama_grammar_accept_token — the exception crosses the C ABI into Dart FFI and the process aborts (SIGABRT in the Dart worker).
Seen on a Pixel 9 Pro in leehack/llamadart#948, where wrong Vulkan logits make the sampler pick a token the grammar rejects. Upstream closed the general report as not planned: ggml-org/llama.cpp#29715. The same abort existed before the wrapper (v0.5.0, direct llama_sampler_sample).
Ask
Wrap each exported llama_dart_* call that can reach throwing llama.cpp code in try/catch (...), return a distinguishable failure value, and expose the last error message so llamadart can raise a typed LlamaException. Cover at least sample, decode/encode, model/context creation and the mtmd calls.
Acceptance
A test that forces a grammar-stack throw and shows the call returns an error and the process survives.
Activity
fix: exception barrier and Vulkan device facts for the v0.6.0-1 wrapp…
leehack commentedon Oct 14, 2026
Fixed by #103 (exception barrier), released in
v0.6.0-1and adopted in llamadart#974.