Sublime Forum

Sublime Error 5:2

#1

Hi there. I’m new to coding and have been using Sublime for a couple of weeks. All of a sudden, I am getting an error message and the text editor isn’t recognizing any code. The following is the error message:

Error trying to parse settings: Unexpected trailing character in Packages/User/Preferences.sublime-settings:5:2

Does anyone know what this error message means and how to fix it?
Thanks in advance.
Faith

0 Likes

#2

Yes, I had exactly the same thing when I started Sublime Text (I was new to code too).

So, the problem is that there is a syntax error in you setting file. In Sublime Text, settings file are in JSON, so you need to respect the JSON syntax.

For your problem

You won’t be able to restart Sublime Text until you’ve fix that error. So, with an other editor (just the default notepad if you want to), you need to open this file.

On window

  1. Open the explorer
  2. In the path bar, paste this: %appdata%/Sublime Text 3/Packages/User
  3. in here, you’ll find Preferences.sublime-settings. Open it up with whatever you want, remove all the content, and add this:
{}

On Mac OS

  1. Open up finder
  2. in the adress bar, paste this in ~/Library/Application\ Support/Sublime\ Text\ 3
  3. do the step 3 of the window list.

On Linux

  1. Open up the equivalent of the window explorer
  2. in the address bar, paste this in ~/.config/sublime-text-3
  3. do the step 3 of the window list.

Quick JSON cheat sheet for Sublime Text’s settings

As I said earlier, ST settings are written in JSON. It’s 1 object. In JSON, an object is represented by a this {} (this is an empty object).

{
    // this is a comment
    "my_setting": "a string", // this is an other comment
    "sublime_text_3": true,
    "a_list": [
        "with",
        "some",
        "items", "in", "it"
    ],
    // note that everything *has* to be seperated by a comma ',' (so not for the last one)
    "the_last_item": "with no comma ->"
}

Some JSON parsers don’t allow comments. The Sublime Text’s parser does.

Some JSON parsers don’t allow trailling commas (the commas at the end). The Sublime Text’s parser does.

0 Likes