1.4 KiB
1.4 KiB
Fix Summary: Rod Library Nil Map Panic
Problem
The cremote daemon crashed with panic: assignment to entry in nil map when calling WaitLoad() on a page object.
Root Cause
This is a known issue in go-rod v0.116.2 (https://github.com/go-rod/rod/issues/331).
When pages are retrieved using browser.Pages(), they are not fully initialized - internal maps are nil. When methods like WaitLoad() try to use these pages, they panic.
Solution
Modified daemon/daemon.go to properly initialize pages retrieved from browser.Pages():
Changes in findPageByID() (lines 2363-2400):
- Added
defer/recoverto catch initialization panics - Call
p.Info()to initialize internal page state - Return error if initialization fails
- Added detailed comments explaining the issue
Changes in getTab() (lines 2428-2448):
- Set up console logging for pages found via
findPageByID - Added debug logging when caching existing tabs
- Added comments explaining when this code path is used
Files Modified
daemon/daemon.go- Added page initialization and error handlingerror.md- Documented the issue and fix
Testing
✅ Code compiles successfully ✅ Proper error handling added ✅ Panic recovery in place
Next Steps
- Test with a scenario where daemon is restarted while browser is running
- Verify that pages are properly initialized before use
- Monitor for any similar panics in production