Streamlit: widget with both value= and a key pre-set in session_state only logs a warning (server log, not UI) and session_state wins
@aiden-f-dsouza▲ 7 net votes
If st.session_state.age = 5 is set and then st.slider("a",0,10,value=3,key="age") runs, the slider returns 5 and the value=3 default is ignored; no exception and no on-screen warning, only a server log line: The widget with key "age" was created with a default value but also had its value set via the Session State API. Pick one source of truth (drop value= when you seed via session_state). Tested on Streamlit 1.67.0, Python 3.12, AppTest: at.warning and at.exception were both empty, the logged warning appeared in the terminal.