Summary
Unable to find where this key error is coming from. I don’t know which part of my code is producing the error.
Steps to reproduce
You can now view your Streamlit app in your browser.
Local URL: http://localhost:8503
Network URL: http://10.0.0.29:8503
2023-03-14 06:23:31.376 API queries_quota: 60
2023-03-14 06:23:35.301 Uncaught app exception
Traceback (most recent call last):
File “C:\Users\Ryan\anaconda3\envs\render\lib\site-packages\streamlit\runtime\state\session_state.py”, line 368, in getitem
return self._getitem(widget_id, key)
File “C:\Users\Ryan\anaconda3\envs\render\lib\site-packages\streamlit\runtime\state\session_state.py”, line 413, in _getitem
raise KeyError
KeyError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “C:\Users\Ryan\anaconda3\envs\render\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py”, line 561, in _run_script
self._session_state.on_script_will_rerun(rerun_data.widget_states)
File “C:\Users\Ryan\anaconda3\envs\render\lib\site-packages\streamlit\runtime\state\safe_session_state.py”, line 68, in on_script_will_rerun
self._state.on_script_will_rerun(latest_widget_states)
File “C:\Users\Ryan\anaconda3\envs\render\lib\site-packages\streamlit\runtime\state\session_state.py”, line 472, in on_script_will_rerun
self._compact_state()
File “C:\Users\Ryan\anaconda3\envs\render\lib\site-packages\streamlit\runtime\state\session_state.py”, line 290, in _compact_state
self._old_state[key_or_wid] = self[key_or_wid]
File “C:\Users\Ryan\anaconda3\envs\render\lib\site-packages\streamlit\runtime\state\session_state.py”, line 370, in getitem
raise KeyError(_missing_key_error_message(key))
KeyError: ‘st.session_state has no key “$$GENERATED_WIDGET_ID-5c25878daf63004803a7aa172ece84aa-None”. Did you forget to initialize it? More info: Add statefulness to apps - Streamlit Docs’
Expected behavior:
Explain what you expect to happen when you run the code above.
Actual behavior:
Explain the undesired behavior or error you see when you run the code above.
If you’re seeing an error message, share the full contents of the error message here.
Debug info
- Streamlit version: (get it with
$ streamlit version
) - Python version: (get it with
$ python --version
) - Using Conda? PipEnv? PyEnv? Pex?
- OS version:
- Browser version:
Requirements file
Using Conda? PipEnv? PyEnv? Pex? Share the contents of your requirements file here.
Not sure what a requirements file is? Check out this doc and add a requirements file to your app.
Links
- Link to your GitHub repo:
- Link to your deployed app:
Additional information
If needed, add any other context about the problem here.