Description
Description
The error appears while trying to load a JSON file inside the litellm
dependency.
β
There was no problem in crewai v0.117.0
.
π« After upgrading to v0.117.1
, the encoding issue started to occur.
Additional Info:
- OS: Windows 11
- Python: 3.12.6
- UV version: latest
- CrewAI installed via
uv tool install crewai
- Running
crewai run
triggers a forced environment rebuild and dependency reinstallation.
Possible Cause:
It seems that during crewai run
, litellm
package tries to load a file without explicitly setting encoding="utf-8"
(default encoding on Windows is cp1254/cp1252, causing crash).
Expected behavior:
- CrewAI should set the correct encoding when reading files.
- Running
crewai run
should not crash immediately due to encoding issues.
Temporary Workaround:
- Downgrade CrewAI CLI back to
v0.117.0
- or manually pin
litellm==1.67.1
and patch code to enforce UTF-8 encoding.
Steps to Reproduce
Install CrewAI CLI via uv tool install crewai
Make sure you have CrewAI version v0.117.1 (uv tool list to verify).
Create a new project using crewai create crew my_project
Enter the project directory.
Run crewai run
Expected behavior
Observe the crash: UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 1980
Screenshots/Code snippets
PS D:\agent_projects\vocavoice> uv tool list
crewai v0.117.1
- crewai.exe
PS D:\agent_projects\vocavoice> crewai run
Running the Crew
Using CPython 3.12.6 interpreter at: C:\Users\yasar\AppData\Local\Programs\Python\Python312\python.exe
Creating virtual environment at: .venv
Built vocavoice @ file:///D:/agent_projects/vocavoice
ββββββββββββββββββββ [0/216] Installing wheels... warning: Failed to hardlink files; falling back to full copy. This may lead to degraded performance.
If the cache and target directories are on different filesystems, hardlinking may not be supported.
If this is intentional, setexport UV_LINK_MODE=copy
or use--link-mode=copy
to suppress this warning.
Installed 216 packages in 9.59s
Traceback (most recent call last):
File "", line 198, in run_module_as_main
File "", line 88, in run_code
File "D:\agent_projects\vocavoice.venv\Scripts\run_crew.exe_main.py", line 4, in
File "D:\agent_projects\vocavoice\src\vocavoice\main.py", line 10, in
from vocavoice.crew import Vocavoice
File "D:\agent_projects\vocavoice\src\vocavoice\crew.py", line 2, in
from crewai import Agent, Crew, Process, Task
File "D:\agent_projects\vocavoice.venv\Lib\site-packages\crewai_init.py", line 3, in
from crewai.agent import Agent
File "D:\agent_projects\vocavoice.venv\Lib\site-packages\crewai\agent.py", line 9, in
from crewai.agents.crew_agent_executor import CrewAgentExecutor
File "D:\agent_projects\vocavoice.venv\Lib\site-packages\crewai\agents\crew_agent_executor.py", line 13, in
from crewai.llm import BaseLLM
File "D:\agent_projects\vocavoice.venv\Lib\site-packages\crewai\llm.py", line 24, in
from litellm.types.utils import ChatCompletionDeltaToolCall
File "D:\agent_projects\vocavoice.venv\Lib\site-packages\litellm_init_.py", line 762, in
from .cost_calculator import completion_cost
File "D:\agent_projects\vocavoice.venv\Lib\site-packages\litellm\cost_calculator.py", line 19, in
from litellm.litellm_core_utils.llm_cost_calc.utils import (
File "D:\agent_projects\vocavoice.venv\Lib\site-packages\litellm\litellm_core_utils\llm_cost_calc\utils.py", line 9, in
from litellm.utils import get_model_info
File "D:\agent_projects\vocavoice.venv\Lib\site-packages\litellm\utils.py", line 188, in
json_data = json.load(f)
^^^^^^^^^^^^
File "C:\Users\yasar\AppData\Local\Programs\Python\Python312\Lib\json_init_.py", line 293, in load
return loads(fp.read(),
^^^^^^^^^
File "C:\Users\yasar\AppData\Local\Programs\Python\Python312\Lib\encodings\cp1254.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 1980: character maps to
An error occurred while running the crew: Command '['uv', 'run', 'run_crew']' returned non-zero exit status 1.
Operating System
Windows 11
Python Version
3.12
crewAI Version
v0.117.1
crewAI Tools Version
v0.117.1
Virtual Environment
Venv
Evidence
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 1980: character maps to
An error occurred while running the crew: Command '['uv', 'run', 'run_crew']' returned non-zero exit status 1.
Possible Solution
- Downgrade CrewAI CLI back to
v0.117.0
- or manually pin
litellm==1.67.1
and patch code to enforce UTF-8 encoding.
Additional context
.