- Chrome Extensions
- Manifest V3
- Analytics
- Releases
- Privacy
Chrome extension error logs: find and collect them in MV3
Chrome extension error logs: where Chrome shows them, which MV3 errors global handlers miss, and how to collect errors from real users with or without Sentry.
- Author
- Extenify Team
- Published
- Reading time
- 13 min read

On this page
Chrome extension error logs are scattered across several places: the Errors button on the extensions page, the service worker's DevTools console, the popup's console and the console of every page your content script runs on. All of them live on one machine, yours. When an update breaks something for users, none of those logs reach you, and the first error report you get is usually a one-star review.
This guide covers both halves of the problem. First, where Chrome shows extension errors while you develop. Then how to collect errors from real users in Manifest V3, including the errors that a global error handler never sees. We tested every claim about runtime behavior in Chromium 159 with Playwright, and the Sentry setup with @sentry/browser 11.14.0.
Key takeaways
- Locally, check four places: the Errors button on
chrome://extensions, the service worker console, the popup console and the page console with your extension selected as the context.- In our tests, a service worker's
errorandunhandledrejectionlisteners caught errors from timers and unawaited promises, but not exceptions thrown insidechrome.runtime.onMessageorchrome.storage.onChangedlisteners. Wrap your event listeners to see those.- A content script's
errorlistener saw only its own errors, not the page's, so a content script can report errors without collecting the website's problems.- Sending a report needs no new host permission: a
text/plainPOST from the service worker reached a server on a host the extension had no permission for.- With Sentry,
Sentry.init()in a content script logged "You cannot use Sentry.init() in a browser extension" and sent nothing. Use a manualBrowserClientandScope, as Sentry's own docs recommend.
Where to find Chrome extension error logs
Chrome's debugging tutorial walks through each component. In short:
| Component | Where its errors show up |
|---|---|
| Manifest | An error dialog when you load the unpacked extension |
| Service worker | The Errors button on chrome://extensions, and the console opened from Inspect views: service worker |
| Popup and options page | The Errors button, and DevTools opened by right-clicking the popup and choosing Inspect |
| Content scripts | The web page's own DevTools console; pick your extension in the context dropdown next to top |
Turn on Developer mode on chrome://extensions to see the Errors button. It turns red when there is an error, and it has a Clear all button for starting fresh. Two details from Chrome's documentation catch people out. The Errors page records only "runtime errors, console.warning and console.error", so console.log output never appears there. And content script errors do not show up on the Errors page at all in the tutorial's example: you find them in the console of the page the script runs on.
Edge has the same tools at edge://extensions, since it runs the same extension platform.
These views are good enough while you develop and for a user who is willing to send you a screenshot. They tell you nothing about the errors happening on thousands of machines after a release.
What global error handlers miss in Manifest V3
The obvious way to collect errors from users is to listen for them globally. In a service worker:
self.addEventListener('error', (event) => { /* report event.error */ });
self.addEventListener('unhandledrejection', (event) => { /* report event.reason */ });
We loaded a test extension into Chromium 159 and triggered six kinds of failure. Here is what the global listeners saw:
| Where the error happened | Caught by the service worker's global listeners? |
|---|---|
throw inside a setTimeout callback |
Yes, as error |
| A promise rejected and never awaited | Yes, as unhandledrejection |
An async function that throws, called without await |
Yes, as unhandledrejection |
A synchronous throw inside a chrome.runtime.onMessage listener |
No. The sender's sendMessage promise rejected with the error message instead |
A throw inside a chrome.storage.onChanged listener |
No |
Content script, its own throw |
Yes, in the content script's window listener, with filename set to the script's chrome-extension:// URL |
The gap is the important part. Most extension code runs inside chrome.* event listeners: messages, storage changes, alarms, tab events, installs. When one of those listeners throws synchronously, Chrome handles the exception itself, and in our test it never reached self.onerror. A reporter built only on global listeners will miss exactly the errors you most want to see.
The content script result is good news. Content scripts run in an isolated world, and in our test the content script's error listener received its own error but not the two errors the web page threw. You still should filter by file name, as the code below does, but you are not collecting every broken website on the internet.
Option 1: a dependency-free error reporter
This module runs in the service worker. It sends each distinct error once per worker lifetime, caps the total so a crash loop cannot flood your server, strips page URLs from stack traces, and gives you a guard() wrapper for event listeners.
// error-reporter.js: collect errors from users and send them to your endpoint.
// Runs in the service worker. Content scripts and pages forward errors here.
const ENDPOINT = 'https://errors.example.com/v1/extension-errors';
const VERSION = chrome.runtime.getManifest().version;
const MAX_PER_WORKER = 20; // a crash loop must not flood your server
const sent = new Set();
function fingerprint(report) {
const firstFrame = report.stack.split('\n')[1] ?? '';
return `${report.where}|${report.message}|${firstFrame.trim()}`;
}
// Keep only your own files in stack traces: no page URLs, no user paths.
function cleanStack(stack = '') {
const base = chrome.runtime.getURL('');
return stack
.split('\n')
.slice(0, 12)
.map((line) => line.replaceAll(base, '/'))
.filter((line) => !/https?:\/\//.test(line))
.join('\n');
}
export function report(error, where) {
const err = error instanceof Error ? error : new Error(String(error));
const payload = {
where,
name: err.name,
message: err.message.slice(0, 300),
stack: cleanStack(err.stack),
version: VERSION,
browser: navigator.userAgent.match(/(Edg|Chrome|Firefox)\/\d+/)?.[0] ?? 'unknown',
at: new Date().toISOString(),
};
const key = fingerprint(payload);
if (sent.has(key) || sent.size >= MAX_PER_WORKER) return;
sent.add(key);
// text/plain keeps this a simple request: no CORS preflight.
fetch(ENDPOINT, {
method: 'POST',
headers: { 'content-type': 'text/plain' },
body: JSON.stringify(payload),
}).catch(() => {}); // never let reporting throw
}
// Chrome swallows exceptions thrown inside chrome.* event listeners:
// they never reach self.onerror. Wrap each listener to see them.
export function guard(where, listener) {
return function guarded(...args) {
try {
const result = listener.apply(this, args);
if (result instanceof Promise) result.catch((e) => report(e, where));
return result;
} catch (e) {
report(e, where);
throw e; // keep Chrome's own behavior
}
};
}
self.addEventListener('error', (e) => report(e.error ?? e.message, 'worker:error'));
self.addEventListener('unhandledrejection', (e) => report(e.reason, 'worker:rejection'));
// Errors forwarded from content scripts and extension pages.
chrome.runtime.onMessage.addListener((msg, sender) => {
if (msg?.type !== 'error-report' || sender.id !== chrome.runtime.id) return;
const err = Object.assign(new Error(msg.message), { name: msg.name, stack: msg.stack });
report(err, msg.where);
});
Import it first in your service worker (declare "type": "module" on the background entry in manifest.json) and wrap your listeners:
// background.js
import { guard } from './error-reporter.js';
chrome.storage.onChanged.addListener(guard('storage.onChanged', (changes) => {
if (changes.settings) migrateSettings(changes.settings.newValue);
}));
chrome.runtime.onMessage.addListener(guard('runtime.onMessage', (msg, sender, sendResponse) => {
// your existing handler
}));
guard() rethrows after reporting, so Chrome behaves exactly as before, including rejecting the sender's sendMessage call. Content scripts forward their own errors to the worker instead of calling your server from the page:
// content.js: forward this script's own errors to the service worker.
const OWN = chrome.runtime.getURL('');
function forward(error, where) {
const err = error instanceof Error ? error : new Error(String(error));
chrome.runtime.sendMessage({
type: 'error-report', where,
name: err.name, message: err.message, stack: err.stack,
}).catch(() => {}); // the extension may have been updated or disabled
}
window.addEventListener('error', (e) => {
if (e.filename?.startsWith(OWN)) forward(e.error ?? e.message, 'content:error');
});
window.addEventListener('unhandledrejection', (e) => {
// Rejections carry no file name; only forward errors whose stack is ours.
if (String(e.reason?.stack ?? '').includes(OWN)) forward(e.reason, 'content:rejection');
});
We ran this in Chromium 159 with the endpoint pointed at a local test server and triggered five errors: one in a content script, one rejection in a content script, one in a timer, one inside a wrapped storage.onChanged listener and one from an unawaited async call inside a wrapped onMessage listener. All five arrived, the web page's own error did not, and each stack trace was reduced to extension paths such as at /background.js:4:27. A report looked like this (the at timestamp is left out here):
{
"where": "storage.onChanged",
"name": "Error",
"message": "settings migration failed",
"stack": "Error: settings migration failed\n at /background.js:4:27\n at guarded (/error-reporter.js:51:31)",
"version": "2.4.0",
"browser": "Chrome/159"
}
Two practical notes. First, the test manifest had no host permission for the endpoint's host, and the reports still arrived: a text/plain POST is a simple request, so CORS only stops you from reading the response, which you do not need. That matters because adding a host permission in an update can trigger a new permission warning. Second, a service worker can be stopped at any time, so a report started just before shutdown can be lost. For error reporting that is an acceptable trade; do not use this pattern for data you must not lose.
On the server, store each report with its version, and count distinct where|message pairs per version per day. That one table answers the question you actually have after a release: did this version introduce a new error, and how often does it happen?
Option 2: Sentry in a Chrome extension
If you already use Sentry, it works in an extension, with one important rule. Sentry's shared environments guide says not to use Sentry.init() in a browser extension, because it "will pollute the global state", and a website that also uses Sentry could end up receiving your events or you its events.
We checked what actually happens with @sentry/browser 11.14.0:
Where Sentry.init() ran |
Result in our test |
|---|---|
| Content script | Logged "You cannot use Sentry.init() in a browser extension" in the page console; no event was sent |
| Popup | Event sent |
| Service worker | Event sent |
The popup and worker work, but the recommended setup is the same everywhere: a manual client and scope, with the integrations that patch globals removed.
// sentry-client.js: a Sentry client that stays out of global state.
import {
BrowserClient,
Scope,
defaultStackParser,
getDefaultIntegrations,
makeFetchTransport,
} from '@sentry/browser';
// Integrations that patch globals would also capture other code's errors.
const GLOBAL_INTEGRATIONS = ['BrowserApiErrors', 'BrowserSession', 'Breadcrumbs',
'ConversationId', 'GlobalHandlers', 'FunctionToString'];
const client = new BrowserClient({
dsn: 'https://<key>@o<orgId>.ingest.sentry.io/<projectId>',
transport: makeFetchTransport,
stackParser: defaultStackParser,
integrations: getDefaultIntegrations({}).filter((i) => !GLOBAL_INTEGRATIONS.includes(i.name)),
release: chrome.runtime.getManifest().version,
sendDefaultPii: false,
});
export const scope = new Scope();
scope.setClient(client);
client.init(); // after setClient, as Sentry's docs require
self.addEventListener('error', (e) => scope.captureException(e.error ?? e.message));
self.addEventListener('unhandledrejection', (e) => scope.captureException(e.reason));
Because GlobalHandlers is removed, the last two lines add the worker's own listeners back. They have the same blind spot as before, so wrap your chrome.* listeners and call scope.captureException(error) in the catch, exactly like guard() above. In our test this client sent a timer error, an unhandled rejection and an error caught inside a storage.onChanged listener, each tagged with the manifest version as the release.
Things to check before you ship it:
- Bundle size. Our minified service worker bundle with this client was about 87 KB, or 31 KB gzipped. Fine for most extensions, noticeable for tiny ones.
- No remotely hosted code. Manifest V3 extensions must bundle all their code. Do not use Sentry's Loader Script or
lazyLoadIntegration(), which loads integrations from the Sentry CDN. Our esbuild bundles contained no CDN URLs; check yours with a search forhttpin the built files, which is what Chrome's guide suggests. - Inbound filters. Sentry can drop errors it thinks come from browser extensions. If your events do not appear, its docs point to the project's Inbound Filters setting.
Privacy and store policy
Error reports are user data, even when they contain no names. Keep them boring:
- Send the message, a cleaned stack, the extension version and the browser version. Leave out page URLs, page content, form values and anything the user typed.
- Describe error reporting in your privacy policy and in the Chrome Web Store privacy practices for your item, and follow the Chrome Web Store program policies on data use.
- On Firefox, declare what you collect in the manifest's data collection permissions and respect the user's choice; our guide to Firefox data collection consent shows how.
- Consider an opt-out in your options page. It costs little and makes the disclosure easy to write.
Connect error logs to releases, ratings and reviews
Error logs tell you what broke. Store data tells you what it cost. The two belong side by side:
- Tag every report with the version. Then a new error that appears only in the latest version points straight at the release.
- Watch the first days of a rollout. Chrome Web Store updates reach users over hours to days, so the error count per version climbs as the version spreads. Our guide on what to watch in the week after an extension release lists the other signals for the same week.
- Read reviews next to errors. If a new error appears on Tuesday and one-star reviews mention the same feature on Wednesday, you have your cause. Our guide to Chrome extension review notifications gets every new review to your team the day it is posted.
- Catch it before release next time. Many listener errors can be reproduced in an automated test; see how to test a Chrome extension with Playwright.
Extenify covers the store side of this picture. It tracks your extension on the Chrome Web Store, Edge Add-ons and Firefox Add-ons, records every new version it sees, and sends a daily alert when a new version goes live, a one-star review arrives, the rating drops or users swing, to email, Slack, Telegram, Discord or Microsoft Teams. Put those alerts next to your error reports and a bad release shows up in both within a day. You can also watch competitors the same way, which our Chrome extension competitor analysis guide walks through. Every plan starts with a 7-day free trial, no credit card required; see Extenify pricing.
Chrome extension error logging checklist
- Know where each component's errors show up locally, including the page console for content scripts.
- Add
errorandunhandledrejectionlisteners in the service worker, content scripts and extension pages. - Wrap every
chrome.*event listener so synchronous throws are reported. - Filter content script errors to your own files.
- Deduplicate and cap reports per worker lifetime.
- Strip URLs and user content; send version and browser.
- If you use Sentry, use a manual
BrowserClientandScope, neverSentry.init()in a content script, and no CDN loading. - Disclose error reporting in your privacy policy and store listing.
- Count errors per version after every release, next to ratings and reviews.
Frequently asked questions
Where are Chrome extension error logs?
On chrome://extensions, with Developer mode on, each extension has an Errors button that lists runtime errors and console.error and console.warn output. The service worker's console opens from the "Inspect views: service worker" link on the same card, and content script errors appear in the console of the page they run on, after you select your extension as the console's context.
How do I see errors from my extension's service worker?
Click "Inspect views: service worker" on the extension's card to open its DevTools console, or click Errors. For errors on users' machines, you need a reporter like the one in this guide.
Why doesn't self.onerror catch errors in chrome.runtime.onMessage?
Chrome invokes extension event listeners itself and handles exceptions thrown synchronously inside them. In our Chromium 159 test, a throw inside an onMessage listener rejected the sender's sendMessage call and never reached the worker's error listener; a throw inside storage.onChanged did not reach it either. Wrap each listener in a try/catch that reports the error.
Can I use Sentry in a Chrome extension?
Yes, with a manual BrowserClient and Scope instead of Sentry.init(), and without integrations that patch global state. In our test, Sentry.init() in a content script refused to start and sent nothing. Bundle the SDK with your extension, because Manifest V3 does not allow loading code from a CDN.
Do I need a host permission to send error reports?
Not for a simple request. In our test, the service worker sent text/plain POST requests to a server on a host the manifest did not list, and the server received them all. You only need a host permission, or CORS headers on your server, if your code must read the response.
Do I need to disclose error reporting?
Yes. Error reports are data sent from users' browsers, so describe them in your privacy policy and in your store listing's privacy information, and on Firefox declare them in the data collection permissions. Keeping reports free of URLs and page content makes that disclosure simple.
Summary
Chrome extension error logs exist on your machine by default: the Errors button, the service worker console and the page console. To see what happens after a release, collect errors from users. Global error and unhandledrejection listeners catch timer errors and unhandled promises, but in our tests they missed exceptions thrown inside chrome.* event listeners, so wrap those listeners. Report from the service worker with a small dependency-free module or a manual Sentry client, keep the reports free of user data, tag them with the version, and read them next to your store ratings and reviews.
Image credits
- Cover photo: Beetle resting on a fresh green leaf by jorinl on the WordPress Photo Directory, CC0.


