DevTools failed to load SourceMap: Could not load content for chrome-extension://

avatar
Borislav Hadzhiev

Last updated: Mar 7, 2024
3 min

banner

# DevTools failed to load SourceMap: Could not load content for chrome-extension://

To solve the error "DevTools failed to load SourceMap: Could not load content for chrome-extension":

  1. Click on F12 to open the developer tools or right-click and click "Inspect".

  2. Click on the Cogwheel in the upper right corner.

click on the cogwheel

  1. Make sure that "Preferences" is selected under "Settings" in the left sidebar.

  2. In the "Sources" section, uncheck the "Enable JavaScript source maps" checkbox to disable it.

disable javascript source maps

  1. Still in the "Sources" section, scroll down to the "Enable CSS source maps" checkbox and uncheck it to disable it.

disable css source maps

This approach also gets rid of the warning when loading the Tensorflow library using a script tag.

Note that you should only switch off "Enable JavaScript source maps" and "Enable CSS source maps" if you aren't developing Chrome extensions as that would prevent you from being able to debug your code.

shell
DevTools failed to load SourceMap: Could not load content for chrome-extension://abc/include.preload.js.map: HTTP Error: status code 404, net::ERR_UNKNOWN_URL_SCHEME DevTools failed to load source map: Could not load content for chrome-exension: HTTP error: status code 503, net::ERR_HTTP_RESPONSE_CODE_FAILURE

Once you disable the following 2 options you won't see the "Could not load content for chrome-extension" warnings:

  • Enable JavaScript source maps
  • Enable CSS source maps

Turning off the 2 options disables source maps in developer tools.

# Enabling the "Selected Context Only" option

An alternative solution would be to enable the "Selected Context Only" option.

The option is used to hide messages from different JavaScript contexts.

To enable the "Selected Context Only" option:

  1. Click on F12 to open the developer tools or right-click and click "Inspect".
  2. Click on the Cogwheel in the upper right corner.

click on the cogwheel

  1. Make sure that "Preferences" is selected under "Settings" in the left sidebar.

  2. In the "Console" section, check the "Selected context only" checkbox to enable it.

enable selected context only

Source maps allow us to map a minified file back to an unbuilt state. When you build your JavaScript files for production, you minify and bundle them.

To be able to still get informative error messages even after building your JavaScript files for production, Source maps can be generated.

Source maps hold information about the original JavaScript files which helps identify where exactly an error occurred.

However, sometimes you get Source map-related warnings from Chrome extensions that you have no control over, so turning them off is fine.

Alternatively, you can try to find the extension that causes the warnings.

# Find the extension that causes the warnings

To find the extension that causes the warnings:

  1. Click on the Extensions Icon in the top right content of your Chrome browser window.

manage extensions

  1. Click on the "Manage extensions" button.

  2. Turn off an extension.

switch off extension

  1. Switch to the page you previously had open and reload it.
  2. Check if the warning "SourceMap: Could not load content" disappeared.
  3. Repeat the process for each extension until you find the extension that causes the warnings.

Once you find the extension that causes the warnings, you can leave it disabled or contact the extension's developer and report the issue.

Another thing you can try if you can't disable the extension is to click on the "Details" button once you've found the extension that causes the issue and enable "Allow access to file URLs".

allow access to file urls

The source map warnings are sometimes caused when an extension doesn't have the permissions it requires.

# Additional Resources

You can learn more about the related topics by checking out the following tutorials:

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.