Toml decoder error (TomlDecodeError)

As of this evening, I cannot do anything with streamlit, not even run the streamlit hello or even streamlit version. The only thing I can think of that chagned was commiting my code to a new GitHub repository. The error I get is:

(base) C:\Users\Erik\Desktop>streamlit hello
Traceback (most recent call last):
  File "c:\users\erik\anaconda3\lib\", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\erik\anaconda3\lib\", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\Erik\Anaconda3\Scripts\streamlit.exe\", line 5, in <module>
  File "c:\users\erik\anaconda3\lib\site-packages\streamlit\", line 34, in <module>
    import streamlit.bootstrap as bootstrap
  File "c:\users\erik\anaconda3\lib\site-packages\streamlit\", line 30, in <module>
    from streamlit.server.Server import Server
  File "c:\users\erik\anaconda3\lib\site-packages\streamlit\server\", line 36, in <module>
    from streamlit.ReportSession import ReportSession
  File "c:\users\erik\anaconda3\lib\site-packages\streamlit\", line 42, in <module>
    from streamlit.watcher.LocalSourcesWatcher import LocalSourcesWatcher
  File "c:\users\erik\anaconda3\lib\site-packages\streamlit\watcher\", line 79, in <module>
    FileWatcher = get_file_watcher_class()
  File "c:\users\erik\anaconda3\lib\site-packages\streamlit\watcher\", line 60, in get_file_watcher_class
    watcher_type = config.get_option("server.fileWatcherType")
  File "c:\users\erik\anaconda3\lib\site-packages\streamlit\", line 95, in get_option
  File "c:\users\erik\anaconda3\lib\site-packages\streamlit\", line 852, in parse_config_file
    _update_config_with_toml(file_contents, filename)
  File "c:\users\erik\anaconda3\lib\site-packages\streamlit\", line 774, in _update_config_with_toml
    parsed_config_file = toml.loads(raw_toml)
  File "c:\users\erik\anaconda3\lib\site-packages\toml\", line 379, in loads
    original, pos)
toml.decoder.TomlDecodeError: Key group not on a line by itself. (line 1 column 1 char 0)

Seems like an issue with the toml decoder.

I have uninstalled, reinstalled, upgraded and downgraded to 0.37. Nothing works.




I found the config file at ~/.streamlit.config.toml and deleted the contents. Not sure how/when the config file got set up incorrectly.

The contents of that file (all were on one line) are below

[server]\nheadless = true\nenableCORS=false\nport = \n

Would still be interested to know if this is a bug or something I messed up somehow.


Hey @eriktuck,

Yes it looks like the problem that you were having was the malformed config file. It shouldn’t be a single line file.

Let us know if you have another question.

Could you point me out the location of the ~/.streamlit.config.toml file? I can’t seem to find it unfortunately and I’m having the same error.


Having the same problem here and also unsure about the location of the config.toml file.

I found the .config.toml file in my User Directory (at C:/Users/Erik/.streamlit/config.toml). I originally searched the C:/ drive for .toml files and found it that way. Hope this helps.


Yes found it and it solved the issue. Thanks!

Glad it worked out.

Just a note for others, if you’re on a Windows system dot files/folders (like .streamlit/) may be hidden by default. You’ll have to change that to see this file in your directory.

1 Like

Hi @eriktuck,

Quick question, are you seeing the file at C:/Users/Erik/.streamlit.config.toml or at C:/Users/Erik/.streamlit/config.toml?

Also did you create this file manually?

1 Like

Right. I found the file at C:/Users/Erik/.streamlit/config.toml. Typo on my part.

I was able to recreate the error. I am deploying my app to Heroku. I have a file. If I run the file outside of the Heroku environment (e.g., double click the file on my computer), it populates the config.toml file with the single line. The file contents are pasted below, so you can see how this is happening. I’m running Windows 8.1 locally.

mkdir -p ~/.streamlit/

echo "\
email = \"\"\n\
" > ~/.streamlit/credentials.toml

echo "\
headless = true\n\
port = $PORT\n\
" > ~/.streamlit/config.toml

Hi Erik
I am having similar issue and couldn’t find the config file. I am using MacBook. I can see the streamlit folder but no config.toml file.

Welcome to the forum @KIRTISNIGDHA :wave: ,

This thread might help answer your question. Feel free to let us know if you need any additional help!

1 Like

Hey Erik,
I did find the config.toml file but how do I edit it now, as in where can I find the appropriate content of the file?

I deleted the file entirely. You might, to be safe, simply move it to a different directory and/or change the name of the file. But, for me, deleting it solved the problem.


Many thanks!

Deleting Credentials.toml and Config.toml resolves my problem


I found I had this issue on Windows 10 when I ran:

streamlit config show > ~/.streamlit/config.toml

For example, with no config.toml file I run:

streamlit hello

And I am greeted with:

  You can now view your Streamlit app in your browser.

  Local URL: http://localhost:8501
  Network URL:

I then run:

streamlit config show > ~/.streamlit/config.toml

And then running streamlit hello I am greeted with:

PS C:\Users\sbiggs> streamlit config show > ~/.streamlit/config.toml
PS C:\Users\sbiggs> streamlit hello
Traceback (most recent call last):
  File "c:\users\sbiggs\appdata\local\continuum\anaconda3\lib\", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\sbiggs\appdata\local\continuum\anaconda3\lib\", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\sbiggs\AppData\Local\Continuum\anaconda3\Scripts\streamlit.exe\", line 4, in <module>
  File "c:\users\sbiggs\appdata\local\continuum\anaconda3\lib\site-packages\streamlit\", line 103, in <module>
    from streamlit.DeltaGenerator import DeltaGenerator as _DeltaGenerator
  File "c:\users\sbiggs\appdata\local\continuum\anaconda3\lib\site-packages\streamlit\", line 27, in <module>
    from streamlit import caching
  File "c:\users\sbiggs\appdata\local\continuum\anaconda3\lib\site-packages\streamlit\", line 40, in <module>
    from streamlit.hashing import Context
  File "c:\users\sbiggs\appdata\local\continuum\anaconda3\lib\site-packages\streamlit\", line 41, in <module>
    from streamlit.folder_black_list import FolderBlackList
  File "c:\users\sbiggs\appdata\local\continuum\anaconda3\lib\site-packages\streamlit\", line 39, in <module>
    if config.get_option("global.developmentMode"):
  File "c:\users\sbiggs\appdata\local\continuum\anaconda3\lib\site-packages\streamlit\", line 90, in get_option
  File "c:\users\sbiggs\appdata\local\continuum\anaconda3\lib\site-packages\streamlit\", line 888, in parse_config_file
    _update_config_with_toml(file_contents, filename)
  File "c:\users\sbiggs\appdata\local\continuum\anaconda3\lib\site-packages\streamlit\", line 810, in _update_config_with_toml
    parsed_config_file = toml.loads(raw_toml)
  File "c:\users\sbiggs\appdata\local\continuum\anaconda3\lib\site-packages\toml\", line 227, in loads
    original, i)
toml.decoder.TomlDecodeError: Found invalid character in key name: '#'. Try quoting the key name. (line 1 column 3 char 2)

The only way I have found to fix it, is to completely delete the file, and then write it a fresh.

Thanks Erik! this was key to solve the problem.

1 Like

Thank you so much! You helped solved it! I was struggling with this since 8 hours. I was deploying apps to heroku and idk what changed. It was working and then suddenly it stopped working!

1 Like

For Mac Users,

I came across this error while trying to deploy my app using Heroku.
so one way to solve this is by removing the config.toml file completely as most of the comments in the comment section suggest. Don’t worry about finding the config.toml file if you are planning to just delete it.

just open terminal execute these commands -

  1. streamlit config show > ~/.streamlit/config.toml
  2. rm -i ~/.streamlit/config.toml

what this will do is completly remove the config.toml file

next, test it using the command streamlit hello and things should be back to normal.