crewai create flow writes a project file the platform default codec cannot encode
Los mantenedores suelen responder en 1 día
@shengzhaowei ya está trabajando en esto.
Desde el 24/11/2026.
Evaluación
- Dificultad
- 1/5
- Tiempo estimado
- Menos de una hora
- Aptitud para principiantes
- 25/100
Línea de trabajo
The bug is in _create_python_flow() and process_file in lib/cli/src/crewai_cli/create_flow.py, which reads the template as UTF-8 but writes it with open(dst_file, "w") and no encoding. Compare with _create_declarative_flow, which uses write_text(content, encoding="utf-8"). Done means the generated tasks.yaml is valid UTF-8 under a non-UTF-8 locale, with a regression test. Pull request #9701 is already open against this issue, so check it before starting.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem
_create_python_flow() in lib/cli/src/crewai_cli/create_flow.py renders the
flow template with process_file, which reads the template as UTF-8 and then
writes the result with the interpreter's locale encoding:
with open(src_file, "r", encoding="utf-8") as file: # read
content = file.read()
...
with open(dst_file, "w") as file: # write: locale encoding
file.write(content)
The templates it renders are UTF-8 and are not ASCII-only:
templates/flow/crews/content_crew/config/tasks.yaml line 45 contains an em
dash (U+2014). On any machine whose default text encoding is not UTF-8 — every
Windows install without the UTF-8 code-page beta (zh-CN is cp936, ja-JP cp932,
…), and any POSIX box under LANG=C — the scaffolded file is written in that
code page instead: the em dash becomes the two bytes a1 aa, which are not
valid UTF-8. So crewai create flow produces a project that the CLI itself
cannot read back:
$ python repro-2.py
locale.getpreferredencoding(False) = cp936
generated demo_flow\src\demo_flow\crews\content_crew\config\tasks.yaml: non-ASCII bytes ['0xa1', '0xaa']
reading it as UTF-8 -> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa1 in position 1496: invalid start byte
EXPECTED: the generated file is valid UTF-8
ACTUAL: 'utf-8' codec can't decode byte 0xa1 in position 1496: invalid start byte
That file is the crew's tasks_config, loaded through
crewai.project.crew_base.load_yaml, which opens it with
encoding="utf-8" (lib/crewai/src/crewai/project/crew_base.py:391), so
crewai run in the freshly created project dies with
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa1 in position 1496
before the flow starts. Note that the other writer in the same module —
_create_declarative_flow — already uses
dst_file.write_text(content, encoding="utf-8"), and
crewai_cli.utils.copy_assistant_instructions/write_env_file do the same; the
Python-flow template writer is the one path left on the locale default.
A PR with the one-line fix and a regression test is #9688.
- Lenguaje dominante
- Python
- Estrellas
- 61.2k
- Forks
- 9.2k
- Merge medio
- 1 d 14 h
- PR fusionados (30 d)
- 180
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de crewAIInc/crewAI
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
[FEATURE] Add Straitly as a native OpenAI-compatible LLM providerPosiblemente ocupada @HashimSyedUBC la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
[BUG] Native OpenAI sync streaming with response_model returns an empty string and emits no completed event when the parse is missingPosiblemente ocupada @basil-k-aji-dev la tomó hace 3 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
[BUG] Native Azure provider ignores the seed settingPosiblemente ocupada @basil-k-aji-dev la tomó hace 3 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
crewAIInc/crewAI#9787 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[BUG] LiteLLM path reports 0 cached and reasoning tokens in the usage summaryPosiblemente ocupada @basil-k-aji-dev la tomó hace 3 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
Todos los issues de crewAIInc/crewAI
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
compiler-explorer/compiler-explorer#9710 ·
Los mantenedores suelen responder en 1 día
-
bug harness
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
mruangutai/harness#2687 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
modal-labs/modal-client#4158 ·
-
kind/bug needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
kubeflow/sdk#998 · 1 comentario ·
Los mantenedores suelen responder en 3 días
-
good first issue
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día