Windows Terminal throws spurious error whenever I save settings.json #12762

Closed
opened 2026-01-31 03:24:18 +00:00 by claunia · 6 comments
Owner

Originally created by @bpstahlman on GitHub (Feb 28, 2021).

Environment

Windows build number: Version 10.0.19042.804
Windows Terminal version (if applicable): 1.5.10411.0
Ubuntu running in WSL1

Any other software?

Steps to reproduce

    • Click Settings in the Windows Terminal menu to open a "settings.json" file in the default editor (Vim for me)
    • Paste a valid json file into the opened "settings.json"
    • Save the file

Expected behavior

No error, terminal settings updated

Actual behavior

Whenever I attempt to save a settings.json file, I get an error such as...

Settings could not be reloaded from file. Check for syntax errors, including trailing commas.
* Line 153, Column 10
  Missing '}' or object member name

Temporarily using the Windows Terminal default settings.

I've tried pasting various settings.json files from online sources: e.g., Thomas Maurer's config

Everything I've tried gives roughly the same error message.
Bizarrely, I've even gotten the same error after pasting the Windows Terminal defaults, which I obtained by holding "Alt" and clicking "Settings" in the menu. The error dialog pops up as soon as I save the file. I've tried both unix and dos linefeeds, and I've tried both latin1 and utf-8 encodings.

Is there a "golden" settings.json I can try?

Originally created by @bpstahlman on GitHub (Feb 28, 2021). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment Windows build number: Version 10.0.19042.804 Windows Terminal version (if applicable): 1.5.10411.0 Ubuntu running in WSL1 Any other software? # Steps to reproduce 1. - Click Settings in the Windows Terminal menu to open a "settings.json" file in the default editor (Vim for me) 3. - Paste a valid json file into the opened "settings.json" 5. - Save the file # Expected behavior No error, terminal settings updated # Actual behavior Whenever I attempt to save a settings.json file, I get an error such as... ``` Settings could not be reloaded from file. Check for syntax errors, including trailing commas. * Line 153, Column 10 Missing '}' or object member name Temporarily using the Windows Terminal default settings. ``` I've tried pasting various settings.json files from online sources: e.g., [Thomas Maurer's config](https://gist.github.com/thomasmaurer/0867873896a3c554413902604a407d0e) Everything I've tried gives roughly the same error message. Bizarrely, _I've even gotten the same error after pasting the Windows Terminal defaults_, which I obtained by holding "Alt" and clicking "Settings" in the menu. The error dialog pops up as soon as I save the file. I've tried both unix and dos linefeeds, and I've tried both latin1 and utf-8 encodings. Is there a "golden" settings.json I can try?
Author
Owner

@zadjii-msft commented on GitHub (Mar 1, 2021):

Weird. The defaults.json should work, especially considering that file is also parsed to create the "default" settings that the terminal falls back to 😃

What editor are you using to modify the settings file? I'm worried it might be sticking a spurious UTF-8 BOM somewhere it shouldn't be

@zadjii-msft commented on GitHub (Mar 1, 2021): Weird. The `defaults.json` _should_ work, especially considering that file is also parsed to create the "default" settings that the terminal falls back to 😃 What editor are you using to modify the settings file? I'm worried it might be sticking a spurious UTF-8 BOM somewhere it shouldn't be
Author
Owner

@bpstahlman commented on GitHub (Mar 1, 2021):

Looks like it was the BOM. When I forced Vim to write the file without the BOM, the error went away. Moreover, it doesn't come back when I reopen settings.json using the Windows Terminal menu. Vim was opening the file with encoding=latin-1, so there shouldn't have been a BOM at all, but the error first occurred when I was still using MS Visual Studio as the default json editor. So maybe MSVS inserted the BOM originally, and it just kept getting propagated through subsequent edits? Can Windows Terminal handle a properly encoded BOM?

Possibly unrelated, but although the parse error is gone, I'm not seeing much color in my Ubuntu terminal, now matter which colorscheme I pick. Do I need to set TERM to something special to get the colors (eg) in my bash prompt to appear?

@bpstahlman commented on GitHub (Mar 1, 2021): Looks like it was the BOM. When I forced Vim to write the file without the BOM, the error went away. Moreover, it doesn't come back when I reopen `settings.json` using the Windows Terminal menu. Vim was opening the file with `encoding=latin-1`, so there shouldn't have been a BOM at all, but the error first occurred when I was still using MS Visual Studio as the default json editor. So maybe MSVS inserted the BOM originally, and it just kept getting propagated through subsequent edits? Can Windows Terminal handle a properly encoded BOM? Possibly unrelated, but although the parse error is gone, I'm not seeing much color in my Ubuntu terminal, now matter which colorscheme I pick. Do I need to set `TERM` to something special to get the colors (eg) in my bash prompt to appear?
Author
Owner

@skyline75489 commented on GitHub (Mar 2, 2021):

@bpstahlman To "get the colors (eg) in your bash prompt to appear", you'll need to have a prompt that has colors. This shouldn't be a problem for bash in WSL. What shell are you using? A screenshot would be good.

@skyline75489 commented on GitHub (Mar 2, 2021): @bpstahlman To "get the colors (eg) in your bash prompt to appear", you'll need to have a prompt that has colors. This shouldn't be a problem for bash in WSL. What shell are you using? A screenshot would be good.
Author
Owner

@bpstahlman commented on GitHub (Mar 2, 2021):

Somehow, my .bashrc had gotten clobbered, which meant I was getting some
sort of default PS1 that had no color. The colors are back now.
Thanks, Brett S.

@bpstahlman commented on GitHub (Mar 2, 2021): Somehow, my .bashrc had gotten clobbered, which meant I was getting some sort of default PS1 that had no color. The colors are back now. Thanks, Brett S.
Author
Owner

@zadjii-msft commented on GitHub (Mar 2, 2021):

Can Windows Terminal handle a properly encoded BOM?

We do handle some BOM cases already, but who knows what the exact byte was that caused this issue. We'd probably need a raw hex dump of the offending file to fix it 😕

Glad you were able to get this resolved!

@zadjii-msft commented on GitHub (Mar 2, 2021): > Can Windows Terminal handle a properly encoded BOM? We do handle some BOM cases already, but who knows what the exact byte was that caused this issue. We'd probably need a raw hex dump of the offending file to fix it 😕 Glad you were able to get this resolved!
Author
Owner

@bpstahlman commented on GitHub (Mar 2, 2021):

Yeah. Clearly this was some sort of BOM corner-case, possibly introduced
when I pasted the Thomas Maurer "settings.json" into my editor from a web
page... I'll know how to resolve (and possibly root cause) if it happens
again, but more relevant parse error messages would probably prevent a lot
of headaches for other users...
Thanks, Brett S.

@bpstahlman commented on GitHub (Mar 2, 2021): Yeah. Clearly this was some sort of BOM corner-case, possibly introduced when I pasted the Thomas Maurer "settings.json" into my editor from a web page... I'll know how to resolve (and possibly root cause) if it happens again, but more relevant parse error messages would probably prevent a lot of headaches for other users... Thanks, Brett S.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#12762