streamlit.errors.StreamlitDuplicateElementKey

I’m running the app on the community cloud.
Here is a link: https://consumerhabits-ev6vuk6x352jzp8nmpkvbi.streamlit.app/
Here is the GitHub repo: GitHub - Leeishere/Consumer_Habits: Consumer_Habits_App_Files

I recieve this error (full traceback below): StreamlitDuplicateElementKey: There are multiple elements with the same
key='1'. To fix this, please make sure that the key argument is unique for
each element you create.

I’ve changed the key from None, to ‘get_bins’, and to ‘get_bins_’. this time it’s int(1). Ther are only 3 other buttons. None have duplicate keys.

I changed all the other interactive element keys (select, multiselect, toggle), but they aren’t a problem. In fact, the app works fine after I press this button.

I will probably just precompute the results the button returns becasue that may be more efficeint for Streamlit. Even though it’s free to me. However, it is a strange bug and I’d be interested in knowing the root cause.

Here’s the traceback:

────────────────────────────────────────────────────────────────────────────────

StreamlitDuplicateElementKey: There are multiple elements with the same

key='1'. To fix this, please make sure that the key argument is unique for

each element you create.

2026-01-03 04:18:47.332 503 GET /script-health-check (127.0.0.1) 414.23ms

────────────────────── Traceback (most recent call last) ───────────────────────

/home/adminuser/venv/lib/python3.13/site-packages/streamlit/runtime/scriptru

nner/exec_code.py:129 in exec_func_with_error_handling

/home/adminuser/venv/lib/python3.13/site-packages/streamlit/runtime/scriptru

nner/script_runner.py:671 in code_to_exec

/mount/src/consumer_habits/Consumer_Habits_App.py:143 in

140 with bin_selection_cell:                                                

141 │   while len(st.session_state.binned_columns)<1:                       

142 │   │   st.subheader("Bin Continuous Variables", divider='grey', ancho  

❱ 143 │ │ get_binned_columns=st.button(“Click Here”,width=‘stretch’,key=

144 │   │   if get_binned_columns:                                          

145 │   │   │   bin_dict=get_dict_for_min_bins()                            

146 │   │   │   data=st.session_state.data.copy()                           

/home/adminuser/venv/lib/python3.13/site-packages/streamlit/runtime/metrics_

util.py:531 in wrapped_func

/home/adminuser/venv/lib/python3.13/site-packages/streamlit/elements/widgets

/button.py:327 in button

/home/adminuser/venv/lib/python3.13/site-packages/streamlit/elements/widgets

/button.py:1354 in _button

/home/adminuser/venv/lib/python3.13/site-packages/streamlit/elements/lib/uti

ls.py:265 in compute_and_register_element_id

/home/adminuser/venv/lib/python3.13/site-packages/streamlit/elements/lib/uti

ls.py:145 in _register_element_id

────────────────────────────────────────────────────────────────────────────────

StreamlitDuplicateElementKey: There are multiple elements with the same

key='1'. To fix this, please make sure that the key argument is unique for

each element you create.

2026-01-03 04:18:52.363 503 GET /script-health-check (127.0.0.1) 437.47ms