[GH-ISSUE #2952] [Issue]: A throwing extension timer/event handler logs an anonymous blob: error instead of naming the extension #1531

Closed
opened 2026-10-21 05:38:12 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @kolacheee on GitHub (Jun 28, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2952

Originally assigned to: @SpicyMarinara on GitHub.

What's wrong

The helper APIs extensions use to register callbacks — marinara.on, marinara.setInterval, marinara.setTimeout, marinara.observe — pass the extension's callback straight to the browser with no error wrapper. So if an extension's interval or event handler throws, you get an anonymous uncaught error attributed only to a blob: URL, with no hint as to which extension is responsible. The file already wraps extension cleanup functions exactly this way (logging [Extension:<name>]); the handler paths just don't.

How to reproduce (try it yourself)

  1. Install an enabled extension whose JS is:
    marinara.setInterval(() => { throw new Error("boom"); }, 500);
    
  2. Load the app and open the console.

You'll see: an uncaught Error: boom every 500ms, attributed only to a blob: URL — no extension name, no way to tell which extension is the culprit.
Expected: the error is caught and logged as [Extension:<name>] … so a user can tell which extension is misbehaving. (The interval correctly keeps firing until the extension is disabled — that part is fine; only the attribution is the issue.)

Where it is

packages/client/src/components/layout/CustomThemeInjector.tsx — the auto-cleanup handlers at lines 205-232 (on, setInterval, setTimeout, observe) pass user callbacks unwrapped to addEventListener / window.setInterval / window.setTimeout / new MutationObserver. The precedent to copy is runExtensionCleanups at lines 123-128, which already try/catches and logs [Extension:${ext.name}]. Error handling currently exists only around the synchronous module import (.catch at 252-258); async handlers registered later run unwrapped.

What's happening

Callbacks registered via the auto-cleanup API run after the module import, outside any try/catch, so a throw is unattributed.

Suggested fix

Wrap the callbacks registered via on / setInterval / setTimeout / observe in a try/catch that console.errors [Extension:${ext.name}], matching line 126. Keep logging the error (don't swallow it) — the uncaught error is currently the only signal a user gets that their extension is broken.


AI-investigated against v2.0.6; cited lines read. Please confirm before fixing.

Originally created by @kolacheee on GitHub (Jun 28, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2952 Originally assigned to: @SpicyMarinara on GitHub. **What's wrong** The helper APIs extensions use to register callbacks — `marinara.on`, `marinara.setInterval`, `marinara.setTimeout`, `marinara.observe` — pass the extension's callback straight to the browser with no error wrapper. So if an extension's interval or event handler throws, you get an anonymous uncaught error attributed only to a `blob:` URL, with no hint as to which extension is responsible. The file already wraps extension cleanup functions exactly this way (logging `[Extension:<name>]`); the handler paths just don't. **How to reproduce (try it yourself)** 1. Install an enabled extension whose JS is: ``` marinara.setInterval(() => { throw new Error("boom"); }, 500); ``` 2. Load the app and open the console. **You'll see:** an uncaught `Error: boom` every 500ms, attributed only to a `blob:` URL — no extension name, no way to tell which extension is the culprit. **Expected:** the error is caught and logged as `[Extension:<name>] …` so a user can tell which extension is misbehaving. (The interval correctly keeps firing until the extension is disabled — that part is fine; only the attribution is the issue.) **Where it is** `packages/client/src/components/layout/CustomThemeInjector.tsx` — the auto-cleanup handlers at lines 205-232 (`on`, `setInterval`, `setTimeout`, `observe`) pass user callbacks unwrapped to `addEventListener` / `window.setInterval` / `window.setTimeout` / `new MutationObserver`. The precedent to copy is `runExtensionCleanups` at lines 123-128, which already try/catches and logs `[Extension:${ext.name}]`. Error handling currently exists only around the synchronous module import (`.catch` at 252-258); async handlers registered later run unwrapped. **What's happening** Callbacks registered via the auto-cleanup API run after the module import, outside any try/catch, so a throw is unattributed. **Suggested fix** Wrap the callbacks registered via `on` / `setInterval` / `setTimeout` / `observe` in a try/catch that `console.error`s `[Extension:${ext.name}]`, matching line 126. Keep logging the error (don't swallow it) — the uncaught error is currently the only signal a user gets that their extension is broken. --- *AI-investigated against v2.0.6; cited lines read. Please confirm before fixing.*
Author
Owner

@SpicyMarinara commented on GitHub (Jun 28, 2026):

Fixed on staging: extension event, timer, timeout, and mutation callbacks are wrapped with named [Extension:<name>] error logging.

<!-- gh-comment-id:4827784921 --> @SpicyMarinara commented on GitHub (Jun 28, 2026): Fixed on staging: extension event, timer, timeout, and mutation callbacks are wrapped with named `[Extension:<name>]` error logging.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#1531
No description provided.