Error in VS Code [Unable to write into user settings. Please open the user settings to correct errors/warnings in it and try again.]
Asked Answered
S

6

20

While changing any setting in Visual Studio I'm getting an error like this:

  Unable to write into user settings. Please open the user settings to correct errors/warnings in it and try again.

In the settings.json There is a problem as:

     Expected Comma JsonC(514)

Error Code:

enter image description here

Sublett answered 6/11, 2020 at 6:19 Comment(4)
Please edit your question by adding the settings.json file. The issue is about a missing comma.Uncovenanted
You missed a comma in your settings.json. Please copy and paste your settings.json content to this questionWeekender
Paste your settings.json file into an online json linter - it'll probably show exactly where the issue is.Jealous
Correcting errors pointed out by vscode on settings.json solved it.Sherwoodsherwynd
W
17

I suggest to validate your JSON in an online JSON validator like jsonlint for better info where the problem lies.

Also, as mentioned in this SO post and this SO post, that leading 0's on a number would also cause this kind of issue.

If you have a number, don't ever store it with leading zeroes. If you have a value that needs to have a leading zero, don't treat it as a number, but as a string. Store it with quotes around it.

Here is an example:

Invalid

{
  "attribute": "// numeroConta",
  "operator": "=",
  "value": 0030152201

}

enter image description here

Valid

{
  "attribute": "// numeroConta",
  "operator": "=",
  "value": "0030152201"
}

enter image description here

Please provide your settings.json if this is not the case.

Wigley answered 5/8, 2021 at 23:0 Comment(1)
All cool and nice... but what about files that you have NOT edited? I'm just having this error, and it's the second time I used this editor. I didn't even knew where to find these JSON files.Statvolt
S
4

One of the most common causes for this is presence of comments inside JSON file. While vscode itself loads config with json-with-comments format, the sync part fails and when you use the GUI to configure settings it fails to update the settings.json file, even if you will not see any error/warning reported on the file.

Stollings answered 24/8, 2021 at 14:47 Comment(0)
L
2

My user preferences JSON file had a syntax error, but VS Code did not report that directly.

Instead of

    ...
    "spellright"
}

there was

    ...
    // "spellright"
}

Comments are not supported in JSON files, once the syntax was corrected, it now works as expected.

Loomis answered 4/6 at 6:45 Comment(0)
G
1

In my case I had to open settings.json and add , on the end of

{
    "workbench.colorTheme": "Default Light+",
    "workbench.colorCustomizations": {
        "editorError.foreground":   "#00000000",
        "editorWarning.foreground": "#00000000",
        "editorInfo.foreground":    "#00000000"
    },
Glycine answered 3/2, 2023 at 13:38 Comment(0)
G
0

In my case, I had a comma at the end of the main curly brackets, but VS Code wasn't alerting to it specifically:

{
    ...
}, // <---
Gulch answered 23/9, 2022 at 0:5 Comment(0)
A
0

@Satyam Shukla you can edit your json and add this:

{
    "window.zoomLevel": 1,
    "remote.SSH.remotePlatform": {
        "xyz.ur.remove.id": "linux"
    },
    "git.ignoreLegacyWarning": true,
    "terminal.integrated.inheritEnv:true,
    "terminal.integrated.env.linux": "bin/bash",
    "update.mode": "none",
},

it will disable vscode gets updated.

Abdomen answered 22/2 at 0:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.