How can an agent resolve this problem? [BUG] JSONLoader rejects valid UTF-8 BOM files
Finding: In a reporter-stated environment (CrewAI source main commit d38ceafb68c6ad33196c9ac052b9b67e74dab37c, Python 3.12.15), crewai_tools JSONLoader reportedly treats a valid UTF-8 JSON file with a leading byte-order mark as malformed. The result has parse_error set in metadata and the content retains the BOM-prefixed raw text, while equivalent BOM-free JSON parses normally (source: https://github.com/crewAIInc/crewAI/issues/8022). Reported conditions: The reporter says to write the bytes EF BB BF followed by a small JSON object to a temporary data.json, then call JSONLoader().load(SourceContent(path)) from crewai_tools.rag.loaders.json_loader. The reporter expects the same parsed content and metadata as the BOM-free file. They say they verified this without network, model or credentials (source: https://github.com/crewAIInc/crewAI/issues/8022).
Reported cause (unconfirmed hypothesis): The reporter attributes the failure to the loader opening files with plain utf-8 encoding. That leaves a leading \ufeff character, which json.loads rejects. This is the reporter's explanation. No maintainer has confirmed it in the supplied thread (source: https://github.com/crewAIInc/crewAI/issues/8022).
Scope: The reporter says this is distinct from the CrewAI CSV BOM reports (#7466) and that their public search found no existing JSONLoader BOM issue or PR. This was not independently checked (source: https://github.com/crewAIInc/crewAI/issues/8022).
Status: The supplied thread has no comments, no maintainer response, no workaround, no fix commit and no released fix. Affected released versions are unknown; only the stated main commit is identified.
Limitations: This is a single external report, and the issue says it was AI-assisted. It is not a KFA reproduction. The snippet was not run by KFA or any independent party. Do not treat the hypothesized cause as confirmed or assume any release contains a fix. If you see this symptom, compare the file's leading bytes and the result of the BOM-free equivalent. That check is only a diagnostic suggestion consistent with the report, not a verified remedy.
Problem details
- Observed symptom
- BOM-prefixed JSON is reported as a parse error in metadata and the content keeps the raw BOM-prefixed text. The same JSON without a BOM parses normally.
- Context
- crewai_tools RAG JSONLoader; CrewAI source main d38ceafb68c6ad33196c9ac052b9b67e74dab37c, Python 3.12.15 (reporter-stated); released package versions unknown; Loading a JSON file with a leading UTF-8 BOM via JSONLoader().load(SourceContent(path)); Single external report; AI-assisted per the issue text; no KFA reproduction; Reproduction not run by KFA or independently; Cause is the reporter's hypothesis; no maintainer confirmation; No exact error string supplied; only a parse_error metadata key is described; No workaround or fix evidence in supplied sources; Related CSV BOM issue #7466 is separate; Comments coverage may be partial
- Environment
- State
- partial
- Text
- CrewAI source main d38ceafb68c6ad33196c9ac052b9b67e74dab37c, Python 3.12.15 (reporter-stated); released package versions unknown; source-reported environment only
- Symptom signature
- Tool product
- crewAI tools
- Component
- crewai_tools RAG JSONLoader
- Operation
- Loading a JSON file with a leading UTF-8 BOM via JSONLoader().load(SourceContent(path))
- Literal error text
- Empty string
- Version info
- CrewAI source main d38ceafb68c6ad33196c9ac052b9b67e74dab37c, Python 3.12.15 (reporter-stated); released package versions unknown
- Literal source
- Not supplied
- Expected behavior
- Not supplied
Known approaches
solution · Revision 1
Use a CrewAI tools release with BOM-aware local JSON loading
Evidence basis: public_source. This finding was not independently executed. The merged upstream change reads local JSON files with UTF-8 BOM-aware decoding: https://github.com/crewAIInc/crewAI/pull/8023. We inspected the published crewai-tools 1.15.30 wheel and confirmed that its local-file loader contains this change: https://pypi.org/pypi/crewai-tools/1.15.30/json. A previous narrow check executed the extracted file-reading methods with a BOM fixture, but did not run the complete JSONLoader or the original reporter's environment.
- Problem id
- 7fdb0011-e852-4aa1-ae0a-3af101d9ce31
- Proposed action
- For local UTF-8 JSON files with a leading BOM, check the installed crewai-tools version and assess upgrading to 1.15.30 under your normal dependency and compatibility checks; then test your own file with JSONLoader.
- Applicability
- State
- partial
- Text
- Local JSON files loaded by crewai-tools; the inspected 1.15.30 wheel contains the BOM-aware decoding change.
- Limitations
- State
- partial
- Text
- The full package and reporter's Python environment were not reproduced. Earliest fixed release and behavior for inline or URL input remain unverified.
- Success criteria
- In your environment, the local BOM-prefixed JSON is parsed as the expected object without a parse_error; compare against the same content without a BOM.
- Risk notes
- Not supplied
- Lifecycle
- active
Page 1 · 1 children total
Sources and related records
No source relations recorded.