
TypeError: this.supportsNativeToolCallingViaEnv is not a function
快速结论:该报错出现在 AnythingLLM Docker 容器连接 LiteLLM 网关时,通常是由于 Docker 镜像版本(如 pg)中缺失了 supportsNativeToolCallingViaEnv 方法的实现。优先更新到最新 Docker 镜像或等待 pg 镜像重建完成。
问题场景
用户在 mintplexlabs/anythingllm:pg Docker 镜像(v1.13.0 及以上版本)中,将 LLM 连接到 LiteLLM 网关时触发。用户已设置环境变量 PROVIDER_DISABLE_NATIVE_TOOL_CALLING="litellm",但问题依然存在。Docker 镜像 v1.12.1 运行正常。
报错原文
The agent model failed to respond: this.supportsNativeToolCallingViaEnv is not a function
[backend] error: TypeError: this.supportsNativeToolCallingViaEnv is not a function
at LiteLLMProvider.supportsNativeToolCalling (/app/server/utils/agents/aibitat/providers/litellm.js:47:38)
at Object.supportsNativeToolCalling (/app/server/models/workspace.js:702:78)
at grepAgents (/app/server/utils/chats/agents.js:52:44)
at streamChatWithWorkspace (/app/server/utils/chats/stream.js:43:29)
at async /app/server/endpoints/chat.js:149:9
原因分析
该报错是由于 LiteLLM provider 在调用 supportsNativeToolCallingViaEnv 方法时,该方法未在运行时定义。根据 Issue 讨论,此问题已被标记为修复(见 PR #5961),重建并发布了 pg 镜像。可能原因:
- Docker 镜像构建时遗漏了该方法的实现代码。
- 方法定义被错误移除或命名差异导致找不到。
环境排查
- 确认使用的 Docker 镜像是否为
mintplexlabs/anythingllm:pg并检查版本(可通过docker inspect查看标签)。 - 检查环境变量
PROVIDER_DISABLE_NATIVE_TOOL_CALLING是否设置为"litellm"。 - 验证 Docker 日志中是否存在其他相关错误。
解决步骤
- 拉取最新 Docker 镜像:
docker pull mintplexlabs/anythingllm:pg或确保使用包含修复的版本(2026年7月3日之后构建的镜像)。 - 如果问题仍然存在,检查 GitHub Actions 运行状态:Actions Run #28680764637,确认
pg镜像重建完成。 - 作为临时方案,可回退到 v1.12.1 版本,该版本无此问题:
docker pull mintplexlabs/anythingllm:pg@v1.12.1(需确认该标签可用)。
验证方法
重启 Docker 容器后,再次连接 LiteLLM 网关,确认不再出现 TypeError: this.supportsNativeToolCallingViaEnv is not a function 错误,且 agent 模型能正常响应。



