日本語

Finding manifest errors with Chrome DevTools

​​Chrome DevTools​JSON,PWA

Opening the Manifest view in the Application panel of Chrome DevTools shows what Chrome read from a web app manifest (manifest.json). A JSON syntax error is reported by line and column, a bad value is reported as a property Chrome ignored, and the reasons the PWA can't be installed are listed in a separate section. When the install button doesn't appear in the address bar, or an icon or color doesn't look as expected, you can check here where the manifest went wrong.

Note

The test environment was Ubuntu 24.04 with Chrome for Testing 158.0.8127.36. I docked DevTools to the bottom of the window and used the English interface, so the panel labels and messages are shown in English. The page was served from a local HTTP server (http://localhost:8080/) with Cache-Control: no-cache. I did not test Chrome on macOS or Windows, Chrome on Android, or what happens after pressing the install button.

The test page

The page is a plain HTML file that loads the manifest with <link rel="manifest">.

html
<!doctype html>
<html lang="ja">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="data:,">
<link rel="manifest" href="manifest.json">
<title>猫の手メモ</title>
</head>
<body>
<h1>猫の手メモ</h1>
</body>
</html>

I prepared three PNG icons: 96×96, 192×192, and 512×512. I changed the contents of manifest.json in the order of a manifest with a JSON syntax error, a manifest with wrong values, and a corrected manifest, and checked what DevTools showed for each.

Opening the Manifest view

I typed application in the DevTools command menu (Ctrl+Shift+P, or Command+Shift+P on macOS), and Show Application appeared in the suggestions. Running it opened the Application panel with Manifest selected at the top of the left list.

The official documentation on debugging PWAs also says to use Manifest in the Application panel to inspect a manifest. At the top of the view, the manifest file name (manifest.json in this case) appears as a link.

JSON syntax errors are reported by line and column

The first case was a manifest with a trailing comma after the last element of the icons array.

json
{
  "name": "猫の手メモ",
  "short_name": "メモ",
  "start_url": "/",
  "display": "standalone",
  "icons": [
    { "src": "icon-192.png", "sizes": "192x192", "type": "image/png" },
    { "src": "icon-512.png", "sizes": "512x512", "type": "image/png" },
  ]
}

In this case, the Manifest view showed only one line, with a red × icon, under Errors and warnings. No name or icon sections were shown.

text
Line: 9, column: 3, Unexpected token.

The Console panel showed the same content as an error starting with Manifest:. The manifest.json:9 link at the right end of the message opened manifest.json in the Sources panel, with a red wavy underline and a × icon on line 9.

The top shows an error line in the Console: "Manifest: Line: 9, column: 3, Unexpected token.", with a manifest.json:9 link at the right end. The bottom shows the Sources panel editor with manifest.json open; there is a red wavy underline under the closing bracket on line 9, and a red × icon to the right of the line
Clicking the Console link opens the line with the error in Sources

Line 9 contains only the ] that closes the array. The extra comma is at the end of line 8, one line above the reported position. The parser treated the ] that came after the comma, instead of another element, as the error. Reading the same file with JSON.parse in Node.js also gave the error Unexpected token ']'.

Bad values appear as ignored properties

The second case was a manifest that is valid JSON but has five wrong values.

json
{
  "name": "猫の手メモ",
  "short_name": "メモ",
  "start_url": "https://example.com/",
  "display": "full-screen",
  "theme_color": "#00c8e8e",
  "background_color": "#ffffff",
  "icons": [
    { "src": "icon-96.png", "sizes": "192x192", "type": "image/png" },
    { "src": "icons/icon-512.png", "sizes": "512x512", "type": "image/png" }
  ]
}

The errors were: a start_url on a different origin from the page, full-screen with a hyphen for display, a seven-digit theme_color, 192x192 declared for an image that is actually 96×96, and icons/icon-512.png in a folder that does not exist. I rewrote manifest.json and reloaded the page with the Application panel still open. The Manifest view updated to the new content without my having to select the list item again.

The Errors and warnings and Installability sections of the Manifest view. Under Errors and warnings, three lines with orange triangle icons say that start_url, display, and theme_color were ignored. Below them are two lines about Richer PWA install UI, a line saying the icon size doesn't match, and a line saying icons/icon-512.png failed to load. Installability has three lines about start_url, display, and an icon of at least 144 pixels.
The Manifest view for the manifest with wrong values

The table below lists the lines shown under Errors and warnings, with the cause of each.

Message shown Cause in the manifest
property 'start_url' ignored, should be same origin as document. start_url is on a different origin from the page
unknown 'display' value ignored. display is full-screen
property 'theme_color' ignored, '#00c8e8e' is not a valid color. theme_color has too many digits
Actual size (96×96)px of Icon http://localhost:8080/icon-96.png doesn’t match specified size (192×192px) sizes does not match the actual image size
Icon http://localhost:8080/icons/icon-512.png failed to load The icon file is missing (the server returned 404)

The first three lines have an orange triangle icon, and their content is that a property was ignored. The lines about the icon size mismatch and the failed icon load have neither a triangle nor a ×. For example, as MDN's description of start_url explains, a start_url on a different origin from the page is not used, and the URL of the page that loaded the manifest is used instead. In this test, the Computed app ID in the Identity section was http://localhost:8080/index.html. The values allowed for display, according to MDN's description of display, are fullscreen, standalone, minimal-ui, and browser. None of them contains a hyphen.

Two more lines starting with Richer PWA install UI also appeared. They suggest adding a screenshot with form_factor set to wide for desktop, and a screenshot with form_factor unset or set to something other than wide for mobile. This manifest has no screenshots, so these lines remained even after the fix.

The reasons for not being installable appear in the Installability section

Below Errors and warnings, an Installability section appeared with these three lines:

text
Manifest 'start_url' isn’t valid
Manifest 'display' property must be one of 'standalone', 'fullscreen', or 'minimal-ui'
No supplied icon is at least 144 pixels square in PNG, SVG, or WebP format, with the purpose attribute unset or set to 'any'

The third line is about icons. The image declared as 192×192 is actually 96×96, and the 512×512 one failed to load, so no icon of at least 144 pixels was available. At this point, no install button appeared in the address bar. The install criteria on web.dev also list 192px and 512px icons, a start_url, and a display set to one of the accepted values.

The Console shows only some of the problems

At the same time, the Console panel showed the following four lines. The text at the start of each line is the link shown at the right end of the message. The three value errors all link to line 1 of manifest.json, so they did not help locate the wrong line.

text
manifest.json:1 Manifest: property 'start_url' ignored, should be same origin as document.
manifest.json:1 Manifest: unknown 'display' value ignored.
manifest.json:1 Manifest: property 'theme_color' ignored, '#00c8e8e' is not a valid color.
index.html:1 Error while trying to use the following icon from the Manifest: http://localhost:8080/icon-96.png (Resource size is not correct - typo in the Manifest?)

The failure to load icons/icon-512.png, and the three lines in Installability, did not appear in the Console. To see all the manifest problems together, open the Manifest view.

Checking the values Chrome uses in the Presentation and Icons sections

Scrolling down the Manifest view, the Presentation section shows start_url, the colors, and display, and the Icons section shows the icon images. I compared these sections for the manifest with wrong values and the corrected one.

Two screenshots stacked vertically. In the top one, for the manifest with wrong values, Start URL is https://example.com/, the Theme color and Background color swatches are both white, and Display is full-screen. The Icons section has one small light-blue icon under the 192×192px heading. In the bottom one, for the corrected manifest, Start URL is /, the Theme color swatch is light blue, and Display is standalone. The icon under the 192×192px heading is larger than in the top one
The Presentation and Icons sections with wrong values and after the fix

With the wrong values, the text I had written in the manifest appeared as is: https://example.com/ for Start URL and full-screen for Display. Ignored values are still shown here, so do not conclude from the Presentation section alone that a value was read correctly. The Theme color swatch, however, was white instead of the light blue I had specified. In the Icons section, only icon-96.png was listed, under the heading "192×192px", and the image was shown at its actual size of 96×96. Comparing it with the 192×192 image after the fix shows the difference in size.

Confirming that the errors are gone after the fix

Here is the manifest with the five problems corrected:

json
{
  "name": "猫の手メモ",
  "short_name": "メモ",
  "start_url": "/",
  "display": "standalone",
  "theme_color": "#00c8e8",
  "background_color": "#ffffff",
  "icons": [
    { "src": "icon-192.png", "sizes": "192x192", "type": "image/png" },
    { "src": "icon-512.png", "sizes": "512x512", "type": "image/png" }
  ]
}

After reloading, the only lines left under Errors and warnings were the two Richer PWA install UI lines, and the Installability section was gone. The Console panel showed nothing, and an Install button appeared on the right side of the address bar. The Icons section listed two images, at 192×192 and 512×512, and the Theme color swatch was light blue.

The top shows the address bar, with an Install button on the right of localhost:8080/index.html. The bottom shows the top of the Manifest view, where Errors and warnings contains only the two lines starting with Richer PWA install UI
After the fix, only the two advisory lines remain under Errors and warnings, and the Install button appears
Point

After fixing a manifest, check the Manifest view: Errors and warnings should contain only the two Richer PWA install UI advisory lines, and the Installability section should be gone. Icon image errors are shown without a triangle or ×, so you will miss them if you only look for those markers. Seeing a value in the Presentation section does not mean Chrome is using that value.

​Posted by 86