unchecked runtime.lasterror: the message port closed before a response was received error message can occur if there is any failure while communicating information (request and response) from background javascript and client script. You can see this error message in the browser’s console window.

This error is generally caused by the browser extensions. You are using an unsupported extension or your extension may have been corrupted. If you are developing a custom extension then there may be an issue with the extension code.
In this article we will study how to get rid of unchecked runtime.lasterror: the message port closed before a response was received error message. Go through the article thoroughly to understand the causes of this error message and their possible solutions.
Solution:
Following are the two possible solutions to resolve the error message.
1. Remove Extension
You can go to the chrome://extensions/ and disable all extensions. Now check if you are able to use chrome without any error message.
If you don’t get any error message, then there is an issue with one of the extensions. Enable extensions one by one and test them. In this way, you can identify which extension is the culprit and causing the issue and you can remove that extension. Chrome does not report explicitly which extension really causing the issue. So you have to toggle extensions one by one.
Following is the list of extensions that may cause the error message. Check if you have installed any of the below extensions.
- 1password extension
- Color Contrast Analyzer
- Google Publisher Toolbar
- Kaspersky browser extension
- Norton Safe web
- Tampermonkey
- MeddleMonkey
- Pinterest extension
- Stay focused
- Piggy – Automatic Coupons & Cash Back
- BuiltWith Technology Profiler
- HonorLock
- Video Downloader Professional
The above list is just an example. It’s not necessary that you are also getting error messages because of the above extensions. We have given the list based on our experience and the feedback we received from our users.
Note:
A. You can use “Disable Extensions Temporarily” extensions to disable and enable all the extension with one click.
B. You can also try using chrome in incognito mode with do not allow extension setting and see if you are able to solve the issue.
If you are still getting the error message then it means there is no issue with the extension. Something else is causing the issue.
Check Other Articles
Only integer scalar arrays can be converted to a scalar index
2. Add a return statement in the background message listener
If you are a developer and using or developing any new custom chrome extension then there may be some issue with your extension code that causes the unchecked runtime.lasterror: the message port closed before a response was received error message. Here we have explained in detail what part of the code can cause this error message and how to resolve it.
Please check the onMessage listener code snippet in your extension code. If this listener does not return the response correctly then it can result in the above error message.
Add return true in the onMessage call listener to resolve the error as shown below:
chrome.runtime.onMessage.addListener(function(rq, sender, sendResponse)
{
setTimeout(function() {
sendResponse({status: true});
}, 1);
return true; // Add return true to fix the error.
});
Note:
A. For some users breakpoint in the extension code was causing the issue. They were able to get rid of error message by removing the breakpoints. So try removing the breakpoints from the code and see whether error message is disappeared.
B. Sometimes antivirus blocks the custom code execution properly that may result in the error message. So try disabling antivirus extension and see whether it solves the error.
Conclusion:
We hope that the methods mentioned above are useful and you are able to identify the extension that causing the issue or able to fix the custom extension code. If you are still getting the unchecked runtime.lasterror: the message port closed before a response was received error message then please do mention it in the comment section or you can communicate with us using our official mail id hello.technolads@gmail.com
Thank you.
Good…
Its worked for me
Thank you
Welcome Inacio.
This was helpful. Thank you
Thanks alot … it got fixed <3