Toml decoder error (TomlDecodeError)

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.


its Working …:slight_smile:


Hi Simon,

I encountered this issue after I deploy at heroku.
why heroku is able to overwrite thyis?

I am having this issue after I edit the config.toml file as shown in the instructions on how to turn off magic printing. I only changed one line

magicEnabled = true
magicEnabled = false

but now I get the decode error. The error persists even after changing back to its original text. I can delete the file as suggested, but then I lose the ability to turn magic off. Maybe someone could suggest another way to prevent it from printing automatically.

Thank you so much eriktuck!!! You just saved my life. I messed up my system when trying to figure out how to present the local host to a online server with Heroku, and weirdly the codes failed to run with the same problem. I have been stayed up all night cuz I need to do a presentation with streamlit today. My mind just exploded for million times to fix the situation, and finally your way works!! Again thank you so much Savior!! Hope you have a wonderful day!

Getting the following error. Any solutions?
toml.decoder.TomlDecodeError: Key name found without value

Thanks a lot, @eriktuck. Moving the file to another directory solved it for me.

have u found any solution to this problem

I will have to change what?

I’m on windows system and I still couldn’t find the file and solve the problem

so how windows user delay with this problem

Hey I thought my error is also similar to this, so I am including the link of my error:

The contents of my file are:

mkdir -p ~/.streamlit/
echo "\
port = $PORT\n\
enableCORS = false\n\
headless = true\n\
" > ~/.streamlit/config.toml

My app is running perfectly on local machine. But it is getting the error described in the above link when I try to deploy it on heroku.

If anybody could help me solving this.