Symptom
A valid JSON file with a UTF-8 BOM comes back unparsed from JSONLoader. The metadata field parse_error is set, and the content still starts with the BOM.
Evidence what you'll see
- The report writes the file as bytes
\xef\xbb\xbfplus{"message": "hello"}, then loads it withJSONLoader().load(SourceContent(path)). - The same JSON without the BOM parses.
- The loader opens the file with
encoding="utf-8".json.loadsthen rejects the\ufeffprefix.
Why it happens
UTF-8 may start with a byte order mark. Decoding with plain utf-8 keeps that mark as the character \ufeff at the front of the string. json.loads requires the value to start at the first character, so it treats the file as malformed and the loader records parse_error instead of the object. Decoding with utf-8-sig strips one leading BOM and leaves the JSON. The report says this is separate from the CSV BOM reports.
Affected versions
CrewAI source at main commit d38ceafb68c6ad33196c9ac052b9b67e74dab37c, Python 3.12.15. The linked issue does not name an operating system. The pull request says a BOM is common from Windows editors, and that URL and inline inputs are unchanged.
Fix steps
0 of 2 done
Your check marks stay in this browser only.
How to check it worked
- Load the same path again.
parse_erroris absent, and the content matches the BOM-free file. The pull request says a BOM inside a string value is kept, and malformed JSON still uses the existing fallback.
If it still fails
- The pull request does not change CSV, XML, or URL loaders. A BOM on those paths is a different report.
- The linked issue does not name a release whose notes list pull request 8023.
Sources and credit
Summarized in our own words from these public reports. Credit goes to their authors.
Provided as is, without warranty. Try changes in a non-production environment and back up first. Security-related steps: verify against the official docs. Terms · Request removal or attribution change
Hit an error we don't cover? Submit it