Frontmatter
| id | 8860 |
| title | Fix Service Worker clone error and Manager initialization race conditions |
| state | Closed |
| labels | bugaicore |
| assignees | tobiu |
| createdAt | Jan 22, 2026, 12:57 AM |
| updatedAt | Jan 22, 2026, 1:08 AM |
| githubUrl | https://github.com/neomjs/neo/issues/8860 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jan 22, 2026, 1:08 AM |
Fix Service Worker clone error and Manager initialization race conditions
tobiu assigned to @tobiu on Jan 22, 2026, 1:03 AM

tobiu
Jan 22, 2026, 1:03 AM
Input from Gemini 3 Pro:
✦ I have applied the following fixes to address the runtime errors in
dist/production:
- Service Worker Clone Error: Updated
src/worker/ServiceBase.mjsto synchronously clone the response inonFetchbefore any async cache operations. This prevents the "Response body is already used" error.- Manager Initialization Race Condition: Updated
src/worker/Manager.mjsto initializeme.promises = {}at the very beginning of theconstructmethod. This ensures it's available whencheckServiceWorkerVersion(and subsequentlypromiseMessage) is called.- Manager getWorker Safety Check: Updated
getWorkerinsrc/worker/Manager.mjsto check for the existence ofthis.workers[name]before accessing its.workerproperty, preventing the "Cannot read properties of undefined" error.The changes have been committed and pushed to
dev.
tobiu closed this issue on Jan 22, 2026, 1:08 AM
This task addresses three runtime errors discovered in
dist/productionbuilds:Service Worker Error:
TypeError: Failed to execute 'clone' on 'Response': Response body is already used.response.clone()method is called inside an asynchronouscaches.open().then()block. By the time this block executes, the browser has likely already consumed the original response body (which was returned immediately torespondWith).Manager Initialization Error:
TypeError: Cannot set properties of undefined (setting 'neo-5')insidepromiseMessage.me.promisesis initialized at the end of theconstructmethod, butcheckServiceWorkerVersion()(which usespromiseMessage) is called earlier in the constructor.me.promises = {}initialization to the beginning of theconstructmethod.Manager getWorker Error:
TypeError: Cannot read properties of undefined (reading 'worker').getWorker(name)attempts to accessthis.workers[name].workerwithout checking ifthis.workers[name]exists.this.workers.