快速结论:该报错通常发生在 Ollama 已设置 OLLAMA_EXPERIMENT=client2 环境变量并尝试从 Hugging Face 拉取模型时。优先排查是否设置了该实验性环境变量,删除后重启 Ollama 服务即可恢复。
适用环境:Linux 操作系统(Issue 用户使用 systemd 服务运行)、AMD GPU、AMD CPU、Ollama 0.6.6/0.6.7 版本。
最快修复方案:删除 OLLAMA_EXPERIMENT=client2 环境变量并重启 Ollama 服务。该方案已在 Issue 评论中得到多名用户验证。
注意事项:该变量属于实验性功能,启用后会影响模型拉取流程。删除变量后若仍复现,需继续排查网络代理、Hugging Face 认证配置等因素;Issue 中未提供其他已验证的修复路径。
问题场景
用户通过 ollama pull hf.co/unsloth/Qwen3-30B-A3B-GGUF:Q4_K_M 命令从 Hugging Face 拉取 GGUF 模型时,Ollama 返回内部服务器错误。服务端日志显示 registry 返回 401 认证失败,且伴随重复的 HTTP 响应头写入警告。
报错原文
ollama pull hf.co/unsloth/Qwen3-30B-A3B-GGUF:Q4_K_M
pulling manifest
Error: internal server error
time=2025-04-30T12:16:43.162+02:00 level=ERROR source=server.go:159 msg=http error="registry responded with status 401: Invalid credentials in Authorization header" status=500 method=POST path=/api/pull content-length=89 remote=127.0.0.1:57634 proto=HTTP/1.1 query=""
原因分析
可能原因是 OLLAMA_EXPERIMENT=client2 实验性环境变量导致 Ollama 使用了新的客户端认证逻辑,在向 Hugging Face registry 发起请求时构造了无效的 Authorization 头,从而触发 401 错误。该变量在 Ollama 0.6.6 及更新版本中引入,Issue 评论中有两位用户确认移除该变量后问题消失。
环境排查
- 确认 Ollama 版本为 0.6.6 或 0.6.7(在更高版本中也可能存在)。
- 检查系统环境变量或 systemd 服务文件中是否设置
OLLAMA_EXPERIMENT=client2。 - 确认 Ollama 服务通过 systemd 或手动方式启动,以便正确重启。
解决步骤
- 查看当前 Ollama 服务配置:
systemctl cat ollama或检查/etc/systemd/system/ollama.service文件。 - 在服务配置或 shell 环境中找到
OLLAMA_EXPERIMENT=client2赋值并删除/注释该行。 - 重新加载 systemd 配置(如适用):
sudo systemctl daemon-reload。 - 重启 Ollama 服务:
sudo systemctl restart ollama,或对非 systemd 环境直接重启 ollama 进程。 - 再次执行原始拉取命令验证修复。
验证方法
重新运行导致报错的 ollama pull 命令,确认不再出现 Error: internal server error,且服务端日志中不再出现 401: Invalid credentials in Authorization header 错误条目,即表示修复成功。
参考来源
AI 工具推荐
想把多个 AI 模型放在一个入口?
GamsGo AI 集成 ChatGPT、DeepSeek、Gemini、Claude、Midjourney、Veo 等常用模型,适合写作、绘图、视频和日常 AI 工作流。
推广链接:通过此链接购买,我可能获得佣金,不影响你的价格。
这个方案解决了吗?
可以继续搜索完整报错,或查看同一工具的其他排查指南。
![[Bug]: MTP spec decode still advances the grammar matcher after termination when a structural tag is built (residual after #44297)](https://www.chat-gpts.plus/wp-content/uploads/2026/08/52767-d83cfbd1-768x403.jpg)
![[Bug]: Native MTP speculative decoding degenerates into garbage token loops on deep agentic conversations (Qwen3-MoE)](https://www.chat-gpts.plus/wp-content/uploads/2026/08/47087-d5d5041b-768x403.jpg)
