Have you ever encountered the Unchecked runtime.lastError: message port closed before a response was received error? If so, you’re not alone. This error typically occurs when you’re using a web service that doesn’t send and receive messages properly.
This error can be quite frustrating to deal with, especially if you don’t know how to fix it. In this blog post, we’ll take a look at what causes this error and how to prevent it from happening. stay tuned!
Why “Unchecked runtime.lasterror: The Message Port Closed Before a Response was Received” Error Occur?
Unchecked runtime.lasterror: The Message Port Closed Before a Response was Received error occurred either because of some conflict with chrome extension or if you are a extension developer then some problem in responding on message in callback.
How to Fix “Unchecked runtime.lasterror: The Message Port Closed Before a Response was Received” Error?
You can fix Unchecked runtime.lasterror: The Message Port Closed Before a Response was Received error in two ways either by disabling the chrome extension one by one or by returning true in onMessage calls/ background message listener if you are a extension developer.
Fix 1: Disable Chrome Extension
To fix this error, go to Chrome Extensions and try disabling one by one to check if the error still persist. Disable one extension then refresh the page , check error still occur or not.
If error still occur means that mean that plugin not causing this error. Now, check another plugin and proceed with same way. In this way, when you stop getting error means that your error is resolved and that extension causing that error.
Steps to Fix this error in Google Chrome:
- You Already have the window open with the console error, open up a second new Tab/ window.
- In the second window, go to: chrome://extensions
- Disable each extension by toggling, and refresh the window with the console after toggling each extension.
- Once you don’t see the error, remove the extension. Mean that extension was causing the error.
You can also disable all plugin at once also. After disabling all plugin if error doesn’t occurred then enable one by one to check which plugin causing the error.
Here is the list of all plugin which can cause Unchecked runtime.lasterror: The Message Port Closed Before a Response was Received error.
- Video Downloader Professional
- VeePN extension
- MeddleMonkey
- Norton Safe Search Extension
- Google Publisher Toolbar
- Norton Safe Web
- Shortkeys (Custom Keyboard Shortcuts) extension
- WhatFont – Find FontColor Contrast Analyzer
- Adskill
- Google™ Search Keyboard Shortcuts – RESULTER
- React-Sight extension
- Stylish
- Screen Capture
- OurStickys
- TamperMonkey
- Piggy
- Wappalyzer
- AdGuard
- Wappalyzer
- Augury
- OrangeMonkey
- Pinterest extension
- 1Password
- Stayfocusd
- BuiltWith Technology Profiler
- HonorLock
Fix 2: Check you are Returning Something on onMessage Calls or not
If you are an extension developer and getting Unchecked runtime.lasterror: The Message Port Closed Before a Response was Received error it means issues with onMessage calls.
Here a simple example backgroundMssgListener.js and make sure you are returning something.
chrome.runtime.onMessage.addListener(function(rq, sender, sendResponse) {
setTimeout(function() {
sendResponse({status: true});
},
1);
// return true; // uncomment this line to Unchecked runtime.lasterror: The Message Port Closed Before a Response was Received error
});