快速结论:当 llama-server 以 router 模式启动并从 preset.ini 加载模型时,如果模型的 model 路径字段被双引号包裹,会导致加载失败,而同一模型用命令行单独启动却正常。优先检查 preset.ini 里的路径是否带了多余引号。
适用环境:llama.cpp 0.4.1-dev(build 11064,commit a894dae93,Clang 20.1.8,Windows x86_64);操作系统 Windows Server 2022 (21H2) – 20348.5622;CPU Intel Xeon E3-1275L v3;32GB DDR3 ECC RAM;显卡 NVidia RTX 3050 6GB(KMD 616.92,CUDA UMD 13.4)。受影响模块为 llama-server。Issue 中的日志未提供 Python、PyTorch 或显式 CUDA runtime 版本。
最快修复方案:把 preset.ini 中每个模型 model 路径外面的双引号去掉,例如写成 model = D:\llama-cpp\models\xxx.gguf,而不是 model = "D:\llama-cpp\models\xxx.gguf"。
注意事项:维护者说明 ini 解析会取到行尾空白前的值,所以路径本身不必加引号;路径中也不要留末尾空白。Issue 未验证含空格路径是否需要其它转义写法,遇到含空格路径时需自行测试。
问题场景
用户使用 llama.cpp 的 llama-server.exe 以 router 模式启动,通过 --models-preset ./models/preset.ini 预定义多个模型(Ministral3、Qwen3.5SuperCoder、Gemma4)。单独用命令行 -m 加载其中一个模型可以正常启动;但走 router 模式后,当 WebUI 请求加载模型时只返回通用的加载失败提示,即使加上 -lv 5 --verbose 也没有更明确的错误描述。
报错原文
srv load_model: loading model '"D:\llama-cpp\models\Ministral-3-8B-Instruct-2512-Q4_K_M.gguf"'
srv load_model: local path '"D:\llama-cpp\models\Ministral-3-8B-Instruct-2512-Q4_K_M.gguf"'
gguf_init_from_file: failed to open GGUF file '"D:\llama-cpp\models\Ministral-3-8B-Instruct-2512-Q4_K_M.gguf"' (Invalid argument)
llama_model_load: error loading model: llama_model_loader: failed to load model from "D:\llama-cpp\models\Ministral-3-8B-Instruct-2512-Q4_K_M.gguf"
llama_model_load_from_file_impl: failed to load model
common_fit_params: encountered an error while trying to fit params to free device memory: failed to load model
原因分析
最可能的原因是 preset.ini 中 model 值被双引号包裹。日志里可以看到 llama-server 把带引号的字符串原样当作本地路径传给 GGUF 加载逻辑,路径开头多了一个 ",于是 gguf_init_from_file 报 Invalid argument 并且打不开文件。命令行单独启动时用户没有加引号,因此能正常加载,这解释了“单模型可用、router 模式失败”的现象。
维护者回复确认:去掉模型路径的引号即可,ini 会解析到行尾空白之前的值;同时提醒不要在末尾留空白。这说明 preset.ini 的解析并不需要外层引号。
环境排查
- 确认 llama.cpp 版本:Issue 中为 0.4.1-dev(build 11064,commit a894dae93)。
- 确认受影响模块是
llama-server的 router 模式,而非单模型命令行模式。 - 检查
preset.ini中所有模型条目的model字段是否带了双引号或尾部空白。 - 确认单独启动可用时使用的命令没有给路径加引号,用于对比。
- 操作系统为 Windows Server 2022 (21H2);显卡 RTX 3050 6GB,KMD 616.92,CUDA UMD 13.4。
- Issue 未提供 Python、PyTorch、显式 CUDA Runtime 版本,无需补充这些项。
解决步骤
- 打开
./models/preset.ini。 - 找到每个模型条目下的
model行,例如model = "D:\llama-cpp\models\Ministral-3-8B-Instruct-2512-Q4_K_M.gguf"。 - 删除路径两侧的双引号,改成
model = D:\llama-cpp\models\Ministral-3-8B-Instruct-2512-Q4_K_M.gguf。 - 对 Qwen3.5SuperCoder、Gemma4 等其它条目做同样处理。
- 确认每行末尾没有多余空格或制表符。
- 重新用原命令启动:
llama-server.exe --models-preset ./models/preset.ini --port 1144 --sleep-idle-seconds 600 --no-warmup。 - 在 WebUI 中重新请求加载模型,观察日志是否还出现带引号的路径。
验证方法
修改后再触发 router 模式加载模型,日志中 load_model 的路径不应再包含 ",gguf_init_from_file 不再报 Invalid argument,模型应能进入加载并完成加载流程。若仍失败,再确认路径中是否存在空格以及末尾是否残留空白。
参考来源
AI 工具推荐
想把多个 AI 模型放在一个入口?
GamsGo AI 集成 ChatGPT、DeepSeek、Gemini、Claude、Midjourney、Veo 等常用模型,适合写作、绘图、视频和日常 AI 工作流。
推广链接:通过此链接购买,我可能获得佣金,不影响你的价格。
这个方案解决了吗?
可以继续搜索完整报错,或查看同一工具的其他排查指南。
![[Bug]: Databricks non-GPT models 400 with reasoning_effort must be a string when reasoning.summary is set](https://www.chat-gpts.plus/wp-content/uploads/2026/09/42347-6e601b9c-768x403.jpg)
![[Bug]: Admin UI model edit persists derived pricing; price-map reload then records Azure spend as $0`](https://www.chat-gpts.plus/wp-content/uploads/2026/09/40649-99c03ccc-768x403.jpg)
![[Bug]: Streaming responses broken since 0.14.0 for ContextChatEngine and similar classes](https://www.chat-gpts.plus/wp-content/uploads/2026/09/22749-8310a4fe-768x403.jpg)