[BUG] Tools whose sanitized name starts with a digit crash every provider's tool conversion before the LLM call
Maintainer thường phản hồi trong vòng 1 ngày
@HhH666-ux đang làm issue này rồi.
Từ ngày 8/11/2026.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- backend-api-design
Hướng nghiên cứu
Start with sanitize_tool_name() in lib/crewai/src/crewai/utilities/string_utils.py, then trace how its result reaches validate_function_name() in lib/crewai/src/crewai/llms/providers/utils/common.py. Reproduce the failure using the offline example in the issue and inspect related tool conversion code in lib/crewai/src/crewai/utilities/agent_utils.py. Done means digit-leading sanitized names pass conversion while ordinary names still work; two open pull requests already address this issue.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Bug Description
sanitize_tool_name() (lib/crewai/src/crewai/utilities/string_utils.py) lowercases, strips disallowed characters, and removes leading underscores — but it happily returns a name starting with a digit: '3D Renderer' → '3d_renderer', '2FA Verifier' → '2fa_verifier'.
convert_tools_to_openai_schema() (lib/crewai/src/crewai/utilities/agent_utils.py:292) builds every provider's tool schema from that sanitized name, and safe_tool_conversion() → validate_function_name() (lib/crewai/src/crewai/llms/providers/utils/common.py:25) then rejects it:
ValueError: OpenAI function name '3d_renderer' must start with a letter or underscore
This happens locally, before any HTTP request, on every function-calling run for such tools — openai, azure, anthropic, bedrock and gemini all funnel through safe_tool_conversion. Meanwhile OpenAI/Anthropic/Bedrock's published name specs (^[a-zA-Z0-9_-]{1,64}$-style) all allow leading digits, so the sanitizer creates a name the providers would accept but crewAI's own validator refuses.
Steps to Reproduce
Offline, no API key — the failing path is sanitize_tool_name + safe_tool_conversion:
from crewai.utilities.string_utils import sanitize_tool_name
from crewai.utilities.agent_utils import convert_tools_to_openai_schema
class T:
name = "3D Renderer"
description = "renders"
args_schema = None
parameters_verify_mode = None
max_usage_count = None
convert_tools_to_openai_schema([T()]) # ValueError
Tools named '3D Renderer', '2024 Sales Analyzer', '2FA Verifier' all crash; a normal name is unaffected.
Expected behavior
The sanitized name should be usable by every provider's validator — e.g. prefix an underscore when the sanitized result starts with a digit ('3d_renderer' → '_3d_renderer'), consistent with how the MCP tool resolver already prefixes mcp_ to satisfy the same validation.
Screenshots/Code snippets
sanitize_tool_name("3D Renderer") # '3d_renderer' -> validate_function_name raises
sanitize_tool_name("2024 Sales Analyzer") # '2024_sales_analyzer' -> raises
sanitize_tool_name("get_weather") # 'get_weather' -> fine
Operating System
Windows 11
Python Version
3.12
crewAI Version
main 2fba413 (1.15.x)
- Ngôn ngữ chính
- Python
- Star
- 60.6k
- Fork
- 9.1k
- Merge trung bình
- 1 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 218
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của crewAIInc/crewAI
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Feature request: GoldenDirectiveTool (harmonic relationship score, full vs cropped reporting)Đang mởfeature-request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
crewAIInc/crewAI#9200 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[FEATURE] Docs: ApifyActorsTool example with a typed-input ActorCó thể đã có người làm @johnisanerd đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
crewAIInc/crewAI#9132 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] Scrape tools reject the documented cookies mapping and drop cookies when the URL is passed at runtimeCó thể đã có người làm @Luckyou-d đã nhận 6 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] OpenAI-compatible embedding model alias breaks embedder constructionCó thể đã có người làm @gokay-ai đã nhận 13 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
crewAIInc/crewAI#8761 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của crewAIInc/crewAI
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug z-test-failure
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
torch-spyre/spyre-inference#1598 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
zilliztech/memsearch#853 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
IPA charactersĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
tywr/Nordwand-Mono#55 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
physical
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
antonyrag/ragleap-core#1339 ·