# Console: Unchecked runtime.lastError: The message port closed before a response was received (extension message)

**Code:** `Unchecked runtime.lastError` · **Category:** Browser · **Seen on:** Chrome, Edge, JavaScript

A browser extension sent or received a message and the other side closed the channel without replying — almost always an extension bug, not your site.

## Meaning

This message floods consoles of developers who have extensions installed. It comes from the extension's content script or background page. To confirm, test in incognito or with extensions disabled. If it comes from your own extension, return `true` from the `onMessage` listener when answering asynchronously, or always call `sendResponse`.

## Common causes

- Extension content script talking to a closed or reloaded page
- `onMessage` listener returns without calling `sendResponse` (async reply)
- Extension updated/reloaded while a tab stayed open
- Extension background page not available (Manifest V3 service worker asleep)
- Third-party extension (password manager, translator, ad blocker)

## Quick fix

1. Test in an incognito window with extensions disabled — if the message disappears it is an extension
2. Disable extensions one by one to find the culprit
3. Extension authors: `return true;` from async `onMessage` listeners

## Detailed fix by platform

### Chrome

1. `chrome://extensions` → toggle extensions off one by one; DevTools console filter "Hide extension messages"

### JavaScript

1. Extension code: `chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => { doWork().then(sendResponse); return true; });`

## How to diagnose

1. **Source** — Does it vanish in incognito?
2. **Which** — Which extension (console source link)?
3. **Own** — Is it your extension?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/browser/chrome-runtime-lasterror-message-port-closed)
