[BUG] Crew.copy() fails with ValidationError when a task has input_files
メンテナーはふだん 1 日以内に返信
@juemimgcd がすでに取り組んでいます。
2026年11月26日 から。
評価
調査の方向性
Start in crewai/task.py at Task.copy() and inspect how it rebuilds a task with model_dump() and preserves context, agent, and tools. Reproduce the reported failure with a task containing input_files; the issue suggests retaining the original file objects when constructing the copy. Done means crew.copy() preserves task input files without a Pydantic validation error. Three open pull requests are already linked, so check their status before taking this on.
索引モデルが issue の本文から書いたものです。
説明
Description
Crew.copy() raises a pydantic ValidationError when any task has input_files. Task.copy() rebuilds the task from self.model_dump(), which turns each file's source (FileBytes, a path, FileUrl) into a plain dict, and the file types' source validator rejects a dict: Cannot convert dict to file source.
Anything that copies a crew therefore cannot be used with file inputs, e.g. code that copies a crew per request so concurrent runs don't share state.
Steps to Reproduce
pip install "crewai[file-processing]==1.15.45"(also reproduced on1.15.45.dev20261126)- Run the snippet below.
Expected behavior
crew.copy() returns a copy whose task keeps its input_files, as it does for a task without them.
Screenshots/Code snippets
from crewai import Agent, Crew, Task
from crewai_files import FileBytes, ImageFile
agent = Agent(role="Analyst", goal="Describe images", backstory="You describe images.", llm="gpt-4o")
task = Task(
description="Describe the attached image.",
expected_output="One sentence.",
agent=agent,
input_files={"chart": ImageFile(source=FileBytes(data=b"\x89PNG\r\n\x1a\n", filename="chart.png"))},
)
crew = Crew(agents=[agent], tasks=[task])
crew.copy() # raises pydantic ValidationError
The same happens with a path source (ImageFile(source=Path("chart.png"))) and with FileUrl(url=...).
Operating System
macOS (also expected on Linux; the failure is in pydantic validation, not platform-specific)
Python Version
3.12
crewAI Version
1.15.45 (and 1.15.45.dev20261126); crewai-files same version
crewAI Tools Version
not installed
Virtual Environment
Venv
Evidence
pydantic_core._pydantic_core.ValidationError: 6 validation errors for Task
input_files.chart.AudioFile.source
Value error, Cannot convert dict to file source [type=value_error, input_value={'data': b'\x89PNG\r\n\x1...'filename': 'chart.png'}, input_type=dict]
input_files.chart.File.source
Value error, Cannot convert dict to file source [...]
input_files.chart.ImageFile.source
Value error, Cannot convert dict to file source [...]
input_files.chart.PDFFile.source
Value error, Cannot convert dict to file source [...]
input_files.chart.TextFile.source
Value error, Cannot convert dict to file source [...]
input_files.chart.VideoFile.source
Value error, Cannot convert dict to file source [...]
With a path source the input value is {'path': PosixPath('.../chart.png')}, same error.
Possible Solution
In Task.copy() (crewai/task.py), exclude input_files from the model_dump and pass the original file objects (or a shallow copy of the dict) to the new task, as is already done for context, agent and tools. Alternatively, let the file source validator accept the dict form it dumps to.
Additional context
Related: #8952 (copying a crew loses task/agent input templates).
- 主要言語
- Python
- スター
- 61.2k
- フォーク
- 9.2k
- 平均マージ
- 1日 14時間
- マージ済み PR(30日)
- 180
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
crewAIInc/crewAI のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
[FEATURE] Add Straitly as a native OpenAI-compatible LLM provider対応中かも @HashimSyedUBC が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
[BUG] Native OpenAI sync streaming with response_model returns an empty string and emits no completed event when the parse is missing対応中かも @basil-k-aji-dev が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
[BUG] Native Azure provider ignores the seed setting対応中かも @basil-k-aji-dev が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
crewAIInc/crewAI#9787 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] LiteLLM path reports 0 cached and reasoning tokens in the usage summary対応中かも @basil-k-aji-dev が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
crewAIInc/crewAI の issue をすべて見る
似ている issue
-
bug harness
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
mruangutai/harness#2687 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
modal-labs/modal-client#4158 ·
-
good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 72/100
The-Swarm-Corporation/swarms-rs#168 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] SMTP listener now binds to EMAIL_PORT instead of 2525 since the gunicorn switch 5.0.3-ls373オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
linuxserver/docker-healthchecks#137 · コメント 1 件 ·