mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-12-01 23:49:22 -06:00
## Summary - Fixes COMPILER-EXPLORER-E53: SyntaxError: Unexpected end of JSON input - Adds robust error handling for malformed client state URLs - Prevents Sentry notifications for user-caused errors ## Root Cause The `extractJsonFromBufferAndInflateIfRequired` function and `unstoredStateHandler` were not properly handling: - Invalid base64 data in URLs - Corrupted or malformed JSON after base64 decoding - Empty JSON strings This caused uncaught `SyntaxError` exceptions that were being sent to Sentry as internal server errors. ## Changes - Added proper error handling for base64 decoding failures - Added validation for empty JSON strings before parsing - Changed logging from `warn` to `debug` since this represents user error - Removed Sentry capture for malformed URLs to reduce noise - Return 400 Bad Request instead of 500 Internal Server Error ## Test Plan - [x] TypeScript compilation passes - [x] All existing tests pass - [x] Manual testing with malformed URLs returns 400 instead of 500 - [x] No Sentry errors generated for user-caused malformed URLs 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Claude <noreply@anthropic.com>