[BUG] JSONLoader rejects valid UTF-8 BOM files
Maintainers usually reply within 1 day
@Vidit-Ostwal is already working on this.
Since Oct 12, 2026.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
Research direction
The bug is in the JSONLoader at crewai_tools/rag/loaders/json_loader.py, which opens files with encoding="utf-8" before calling json.loads. Start by running the reproduction script in the issue, which writes a BOM-prefixed file and calls JSONLoader().load on it, and check where metadata["parse_error"] gets set. Done means the BOM file produces the same parsed content and metadata as the BOM-free equivalent.
Written by the indexing model from the issue text.
Description
Description
JSONLoader treats a valid UTF-8 JSON file with a leading BOM as malformed JSON. The loader opens files with plain encoding="utf-8", and json.loads() rejects the resulting \ufeff prefix. The same JSON without BOM parses normally.
Reproduction
from pathlib import Path
from tempfile import TemporaryDirectory
from crewai_tools.rag.loaders.json_loader import JSONLoader
from crewai_tools.rag.source_content import SourceContent
with TemporaryDirectory() as directory:
path = Path(directory) / "data.json"
path.write_bytes(b"\xef\xbb\xbf{\"message\": \"hello\"}")
result = JSONLoader().load(SourceContent(path))
print(result.metadata, result.content)
Actual: metadata["parse_error"] is set and content retains the BOM-prefixed raw text.
Expected: same parsed content/metadata as the equivalent BOM-free JSON file.
Verified on CrewAI source main d38ceafb68c6ad33196c9ac052b9b67e74dab37c, Python 3.12.15, no network/model/credentials. This is distinct from CrewAI CSV BOM reports (#7466 and its existing PRs); public search found no JSONLoader/BOM issue or PR.
AI-assisted investigation and issue writing; llm-generated label required.
- Dominant language
- Python
- Stars
- 59.6k
- Forks
- 8.7k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 101
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from crewAIInc/crewAI
-
[BUG]: ensure_type_in_schemas incorrectly forces empty schemas {} to {"type": "object"} in anyOf/oneOfPossibly taken @sallyw02 claimed this 3 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
crewAIInc/crewAI#8073 · 4 comments ·
Maintainers usually reply within 1 day
-
[BUG] Restore Flow.chat() configuration when trace finalization failsPossibly taken @MouryB claimed this 4 days ago. Openbug difficulty:easy good first issue help wanted llm-generated
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
crewAIInc/crewAI#8069 · 1 comment ·
Maintainers usually reply within 1 day
-
[BUG] Callable guardrails fail when event metadata cannot inspect their sourcePossibly taken @xiajiahang claimed this 4 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
crewAIInc/crewAI#8056 · 1 comment ·
Maintainers usually reply within 1 day
-
[BUG] MCPClient silently drops empty [] and {} tool arguments (and list items that clean to empty) before they reach the MCP serverPossibly taken @Hugo-DDT claimed this 5 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
[BUG] Qdrant RAG client applies score_threshold to raw cosine similarity, not the 0-1 score it returnsPossibly taken @roydonsequeira claimed this 7 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
All issues in crewAIInc/crewAI
Similar issues
-
area:core-platform effort:S priority:P3 status:in-review type:test
Difficulty 2/5 Under an hour Newbie friendliness 80/100
randomparity/kdive#3246 · 1 comment ·
Maintainers usually reply within 1 day
-
Requantification library converts m/z to mass with the hydrogen-atom mass instead of the proton massOpenbug
Difficulty 1/5 Under an hour Newbie friendliness 85/100
nf-core/metaboigniter#130 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
common-workflow-language/cwl-utils#477 ·
Maintainers usually reply within 1 day
-
Add dependabotOpenfeat
Difficulty 2/5 Under an hour Newbie friendliness 72/100
open-nudge/opentemplate#204 ·
Maintainers usually reply within 1 day
-
github-stale-ci-pr-closer: KV state is double-wrapped, never persists, and hits the depth-32 limitPossibly taken @VascoSch92 claimed this today. Openpriority:medium ready-for-dev
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
OpenHands/extensions#781 ·
Maintainers usually reply within 1 day