Symptom
FileHandler.log opens an existing JSON log in write mode before json.dump. Unsupported metadata raises ValueError after the destination has already been truncated, so earlier records are no longer valid JSON.
Evidence what you'll see
- The report's probe writes
first record, thenlog.log(message="failed record", metadata={"unsupported": object()}), catchesValueError, and finds the file bytes no longer match the original. - Circular metadata triggers the same damage. A failed first write leaves a partial file when no log existed.
- The next successful call treats the damaged JSON as malformed and replaces it with just the new entry.
Why it happens
Serialization runs after the destination is opened for write. Pull request 8173 is still open; it serializes the complete payload before opening the destination, keeps the existing file lock, and leaves an existing log byte-for-byte intact on a serialization error.
Affected versions
Python 3.13.12, macOS arm64, repository lockfile dependencies, main at aa5f2acd9b. The linked issue does not name a released crewai version.
Fix steps
0 of 2 done
Your check marks stay in this browser only.
How to check it worked
- After
log.log(message="failed record", metadata={"unsupported": object()})raisesValueError, the existing log bytes still equal the originalfirst recordfile.
If it still fails
- Pull request 8173 was still open on 20 Oct 2026.
- The linked issue does not give a repair for a log that has already been truncated besides writing a new valid record, which replaces the damaged history.
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