Applies to:
- Plan -
- Deployment -
Summary
Issue: The Download this trace option in the UI can fail for very large traces, sometimes showing anInvalid string length error.
Cause: The UI fetches the trace spans through /btql and then serializes the full trace payload to JSON for download. For very large traces, that serialization can exceed the JavaScript runtime’s maximum string size.
Resolution: Fetch the trace spans through the Braintrust API with pagination instead of using the UI download button.
Diagnosing the failure
Open browser DevTools and check the Network and Console tabs when the download fails. AnInvalid string length error is consistent with a very large trace payload failing during JSON serialization.
Resolution steps
Fetch the trace via SQL
Use SQL to retrieve spans for the trace with full payloads and stable ordering:Reduce trace size at logging time
If large inline payloads are causing repeated issues, move large data to attachments to reduce the size of span payloads during logging and export. See “Optimize large trace logging with attachments” troubleshooting article.Notes
- Filtering by
root_span_idis an efficient way to retrieve a known trace. _pagination_keyprovides a stable ordering for pagination.