VSCode - Unable to write into user settings

Viewed 2003

when I try to change my vscode theme, I get a message saying "Unable to write into user settings" and to correct any errors. I checked my setting but didn't know what was wrong with it. Does anyone see any mistakes? I've pasted my settings code below.

"launch": {
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Local Node File",
            "console": "integratedTerminal",
            "program": "${file}"
        },
        {
            "name": "Launch index.html",
            "type": "chrome",
            "request": "launch",
            "file": "${workspaceFolder}/index.html"
        },
        {
            "files.autoSave": "afterDelay",
            "files.autoSaveDelay": 1000,
            "emmet.includeLanguages": { "erb": "html" } 
        },
        "liveSassCompile.settings.formats": [
            {
                "format": "expanded",
                "extensionName": ".css",
                "savePath": "/css"  
            }
        ], 
        "liveSassCompile.settings.generateMap": false
    ]
}
4 Answers

open your settings.json, find the way line and annotation it

There's 2 problems going on.

1. How to identify JSON syntax errors

I get a message saying ... to correct any errors ... Does anyone see any mistakes?

Any kind of json linter will tell you if your json is valid.

You could use VSCode itself, but since we're on the web, paste your json into https://jsonlint.com/ and right away it shows you there's an error:

Error: Parse error on line 1:
"launch": {   "version": "0.2
--------^
Expecting 'EOF', '}', ',', ']', got ':'

It even has a little ascii art "arrow" pointing to the character that's the problem.

It's complaining because your json has a key ("launch") that's not inside an object ({...}). Compare your json to the launch configuration examples in VSCode Debugging docs, you'll notice that your "launch": is not in those examples. Just remove that so it starts from the first {, i.e.

When you fix that first problem, you hit your second problem:

2. "liveSassCompile.settings.formats" in wrong place

It's the same error as above: a json key not in an object.

Error: Parse error on line 23:
...le.settings.formats": [{           "format": "e
-----------------------^
Expecting 'EOF', '}', ',', ']', got ':'

In this case, it's because you pasted styling settings ("liveSassCompile.settings.formats": { ... }) into the launch configurations array.

You'll need to find the right place to paste those settings, but it's not inside that array — or anywhere in the launch config.

IMO, the real problem is not how to fix the JSON, the real problem is the error msg "Unable to write into user settings". This tells me nothing useful; it makes the issue sound like a permissions problem, not a faulty comma or something in JSON.

I came here because I got the "Unable..." error in VSC, and had no idea how to fix it. The error msg unhelpfully suggests logging into the shared settings, which I unsuccessfully (apparently) attempted to do several times in different ways. That was not the problem at all. Once I fixed a stray comma in my JSON, as implied here, the error went away.

BTW, I'm not looking for upvotes, since this page already explains what the issue is. I'm venting my frustration with VSC...

Check if running vs code as administrator solves your problem, the problem is from permissions that you have. ( only check for troubleshooting ). Also, your JSON format must be valid for save.

Related