Repository navigation
Failed to parse pyproject.toml error when pyproject.toml has comments and CRLF line endings #25809
Copy link
Copy link
Open
Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug
Description
Environment data
- Pylance version: 2026.1.1
- OS and version: Windows 11 build 26200
- Python version (& distribution if applicable, e.g. Anaconda): 3.14.2
Code Snippet
[tool.ruff.lint]
select = [
# flake8-builtins
"A"
]Repro Steps
Create a pyproject.toml, set line endings to CRLF, then simply add a comment anywhere. The Python logs in the output panel will then log an error like this:
2026-02-21 16:17:12.732 [error] Failed to parse `pyproject.toml`: [TomlError: Control characters (codes < 0x1f and 0x7f) are not allowed in comments, use \u000d instead at row 28, col 20, pos 620:
27: select = [
28> # flake8-builtins
^
29: "A",
at i.errorControlCharIn (c:\Users\Joel\.vscode\extensions\ms-python.python-2026.2.0-win32-x64\out\client\extension.js:2:1109372)
at i.parseComment (c:\Users\Joel\.vscode\extensions\ms-python.python-2026.2.0-win32-x64\out\client\extension.js:2:1101920)
at i.runOne (c:\Users\Joel\.vscode\extensions\ms-python.python-2026.2.0-win32-x64\out\client\extension.js:2:1093896)
at i.parse (c:\Users\Joel\.vscode\extensions\ms-python.python-2026.2.0-win32-x64\out\client\extension.js:2:1093642)
at e.exports (c:\Users\Joel\.vscode\extensions\ms-python.python-2026.2.0-win32-x64\out\client\extension.js:2:1127199)
at E (c:\Users\Joel\.vscode\extensions\ms-python.python-2026.2.0-win32-x64\out\client\extension.js:2:802534)
at t.isPipInstallableToml (c:\Users\Joel\.vscode\extensions\ms-python.python-2026.2.0-win32-x64\out\client\extension.js:2:802782)
at s (c:\Users\Joel\.vscode\extensions\ms-python.python-2026.2.0-win32-x64\out\client\extension.js:2:806995)
at c:\Users\Joel\.vscode\extensions\ms-python.python-2026.2.0-win32-x64\out\client\extension.js:2:807364
at ef.value (file:///c:/Users/Joel/AppData/Local/Programs/Microsoft%20VS%20Code/072586267e/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:213:103000)
at I.C (file:///c:/Users/Joel/AppData/Local/Programs/Microsoft%20VS%20Code/072586267e/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:27:2328)
at I.D (file:///c:/Users/Joel/AppData/Local/Programs/Microsoft%20VS%20Code/072586267e/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:27:2398)
at I.fire (file:///c:/Users/Joel/AppData/Local/Programs/Microsoft%20VS%20Code/072586267e/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:27:2615)
at JZ.$acceptModelSaved (file:///c:/Users/Joel/AppData/Local/Programs/Microsoft%20VS%20Code/072586267e/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:144:125565)
at LE.S (file:///c:/Users/Joel/AppData/Local/Programs/Microsoft%20VS%20Code/072586267e/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:125501)
at LE.Q (file:///c:/Users/Joel/AppData/Local/Programs/Microsoft%20VS%20Code/072586267e/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:125281)
at LE.M (file:///c:/Users/Joel/AppData/Local/Programs/Microsoft%20VS%20Code/072586267e/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:124370)
at LE.L (file:///c:/Users/Joel/AppData/Local/Programs/Microsoft%20VS%20Code/072586267e/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:123475)
at ef.value (file:///c:/Users/Joel/AppData/Local/Programs/Microsoft%20VS%20Code/072586267e/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:122272)
at I.C (file:///c:/Users/Joel/AppData/Local/Programs/Microsoft%20VS%20Code/072586267e/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:27:2328)
at I.fire (file:///c:/Users/Joel/AppData/Local/Programs/Microsoft%20VS%20Code/072586267e/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:27:2546)
at Jo.fire (file:///c:/Users/Joel/AppData/Local/Programs/Microsoft%20VS%20Code/072586267e/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:9471)
at ef.value (file:///c:/Users/Joel/AppData/Local/Programs/Microsoft%20VS%20Code/072586267e/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:405:9337)
at I.C (file:///c:/Users/Joel/AppData/Local/Programs/Microsoft%20VS%20Code/072586267e/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:27:2328)
at I.fire (file:///c:/Users/Joel/AppData/Local/Programs/Microsoft%20VS%20Code/072586267e/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:27:2546)
at Jo.fire (file:///c:/Users/Joel/AppData/Local/Programs/Microsoft%20VS%20Code/072586267e/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:29:9471)
at MessagePortMain.<anonymous> (file:///c:/Users/Joel/AppData/Local/Programs/Microsoft%20VS%20Code/072586267e/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:405:7571)
at MessagePortMain.emit (node:events:519:28)
at MessagePortMain._internalPort.emit (node:electron/js2c/utility_init:2:2959)] {
fromTOML: true,
wrapped: null,
line: 27,
col: 19,
pos: 620
}
Switching the line ending to LF prevents this error from showing in the logs.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug
Activity
github-actions commentedon Feb 21, 2026
Hi Joel Spadin (@joelspadin), I'm an AI Support assistant here to help with your issue. While the team reviews your request, I wanted to provide some possible tips and documentation that might help you in the meantime.
Explanation:
Potential Duplicate Issues – These issues may be duplicates of your report, but may differ in some of the details.
Potential Workarounds:
\n) line endings forpyproject.toml(for example, via your editor settings or a.gitattributesfile) to avoid carriage return control characters.pyproject.tomlif changing line endings is not feasible.The team will respond to your issue shortly. Please note this is a trial feature and may not be fully accurate. I hope these suggestions are helpful in the meantime. If this comment helped you, please give it a 👍. If the suggestion was not helpful or was incorrect, please give it a 👎. Your feedback helps us improve!
rchiodo commentedon Feb 23, 2026
The callstack you're showing is for the Python extension, not Pylance. Transferring.