The Prettier extension skips a file because no parser matches it
Your error
Failed to resolve a parser, skipping file. If you registered a custom file extension, be sure to configure the parser.1 more line it can showFix it fast
Most common cause, 1 of 3The language is one Prettier does not format, such as Python
Keep Prettier for web files, remove any documentSelectors glob that matches .py, and give Python its own formatter under a [python] scope; install it first with code --install-extension ms-python.black-formatter.
// .vscode/settings.json or User settings.json
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
}
}Short answer
Failed to resolve a parser, skipping file comes from the Prettier VS Code extension when it must format a file that neither Prettier nor a loaded plugin can parse. Give Python its own formatter, map a custom extension with an overrides parser, and list plugins like prettier-plugin-java under plugins. Applies to Prettier 3.10 and extension 12.4.
Which cause do you have?
Ask the Prettier installed in the project which parser it would use for the file. With ignored false, an inferredParser of null means Prettier, plus the plugins and overrides in your config, has nothing for it; a parser name means the problem is in the editor settings instead.
node --input-type=module -e "import * as p from 'prettier'; console.log(await p.getFileInfo('src/main.py'))"Then find the line you see in this list and open its fix:
- 1The language is one Prettier does not format, such as Python
The error shows on .py files (or Go, Rust, C#), after Format Document (Forced) or with a prettier.documentSelectors glob that matches every file - 2A custom file extension has no parser assigned
prettier.documentSelectors lists an extension of your own, such as **/*.tmpl, but the Prettier config has no override for it - 3The plugin for that language is installed but not loaded
The file is PHP, Java, XML, Svelte, Astro or another plugin language, the plugin package is in node_modules, and the config has no plugins entry
What does the error look like?
Failed to resolve a parser, skipping file. If you registered a custom file extension, be sure to configure the parser.Parser not inferred, trying VS Code language.
Cause 1 of 3
The language is one Prettier does not format, such as Python
You seeThe error shows on .py files (or Go, Rust, C#), after Format Document (Forced) or with a prettier.documentSelectors glob that matches every file
Check
The parser cannot be resolved because Prettier core covers JavaScript and web-focused languages only: JSX, Flow, TypeScript, CSS, Less, SCSS, HTML, Vue, Angular, Handlebars, JSON, GraphQL, Markdown, YAML and a few more. The extension registers itself for those languages, so a Python file reaches it only through the forced command or a broad documentSelectors pattern, and then it gives up.
grep -n "documentSelectors\|defaultFormatter" .vscode/settings.jsonFix
Keep Prettier for web files, remove any documentSelectors glob that matches .py, and give Python its own formatter under a [python] scope; install it first with code --install-extension ms-python.black-formatter. Black and autopep8 are published by Microsoft, and Ruff appears in the community list of the VS Code Python docs.
// .vscode/settings.json or User settings.json
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
}
}Verify
Format Document on a .py file now runs Black, and the Prettier output panel stays quiet for it.
code --list-extensions | grep -i black-formatterConfirmed by code.visualstudio.com
Cause 2 of 3
A custom file extension has no parser assigned
You seeprettier.documentSelectors lists an extension of your own, such as **/*.tmpl, but the Prettier config has no override for it
Check
Prettier picks a parser from the file extension. A pattern in prettier.documentSelectors makes the extension accept such files, yet Prettier still cannot tell how to parse them, and the VS Code language id does not help either. The extension README says such a selector needs a matching override, which is why the message mentions custom file extensions.
cat .prettierrcFix
Add an overrides entry that names the files and the parser Prettier should use for them.
{
"overrides": [
{
"files": ["*.tmpl"],
"options": { "parser": "html" }
}
]
}Verify
getFileInfo now returns the parser you set, and saving the file formats it.
node --input-type=module -e "import * as p from 'prettier'; console.log(await p.getFileInfo('views/page.tmpl'))"Confirmed by raw.githubusercontent.com
Cause 3 of 3
The plugin for that language is installed but not loaded
You seeThe file is PHP, Java, XML, Svelte, Astro or another plugin language, the plugin package is in node_modules, and the config has no plugins entry
Check
Prettier 3.0 removed the automatic plugin search, so a plugin is used only when you name it through the plugins option, the --plugin flag or the API. An installed package that the config never mentions leaves the file without a parser, and the extension does not register itself for that language either.
npm ls --depth=0 | grep -i prettierFix
List the plugin in the Prettier config. Strings in plugins are passed to import(), so the package name is enough when it is installed in the project.
npm install --save-dev prettier prettier-plugin-java
// .prettierrc
{
"plugins": ["prettier-plugin-java"]
}Verify
The CLI formats the file with the plugin loaded through the config.
npx prettier --check src/Main.javaConfirmed by prettier.io
How do I stop it coming back?
- Set editor.defaultFormatter per language in a committed .vscode/settings.json instead of one global value for everything.
- Keep every Prettier plugin in devDependencies and in the plugins list of the same config file, and review both in one change.
- Run npx prettier --check in CI so a file type with no parser shows up as an error there, not only in one editor.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.