Developer Tools

Llama.cpp b9945 fixes crash on custom chat templates gracefully

New release catches parser errors instead of aborting with SIGABRT

Deep Dive

The open-source C++ inference engine llama.cpp, maintained by ggml-org, rolled out version b9945 with a critical stability fix. The bug surfaced when models used chat templates that parsed successfully during initialization but threw std::invalid_argument at application time—for example, templates containing Jinja2 features like {% call %}. Previously, the thinking-probe call (common_chat_templates_support_enable_thinking()) ran outside the try/catch block guarding common_chat_templates_init(), so the exception went uncaught and caused the entire process to abort with SIGABRT.

The fix is surgical: the probe is now nested inside the existing try/catch, so any apply-time parser failure is caught and treated the same way as an init-time parse failure—loading fails gracefully with an error message rather than a crash. This improvement matters especially for developers running custom or complex chat templates in production. The release also bundles builds for macOS Apple Silicon (arm64), Intel macOS, Linux (x64, arm64, s390x) with Vulkan, ROCm 7.2, OpenVINO, SYCL, and Android arm64, plus Windows (x64/arm64) with CUDA 12/13, Vulkan, and HIP. iOS XCFramework and openEuler builds are also available.

Key Points
  • Fixed uncaught exception (std::invalid_argument) causing SIGABRT when a chat template fails at apply time
  • Moved the chat-template thinking probe inside the existing try/catch block to ensure graceful load failure
  • Release includes builds for macOS, Linux, Windows, Android, iOS, and openEuler across multiple GPU backends

Why It Matters

Prevents crashes when loading models with custom Jinja2-style templates, improving reliability for developers using llama.cpp.

📬 Get the top 10 AI stories daily