hi team,
i am facing the below error in my deployed streamlit app. To give some background, in my app user selects filters on UI to filter data and perform some calculations and generate ppt and download the ppt. to give code example:
export_figures_to_ppt(
df_full = full_df, df= filtered_df, df_p1=current_df, df_p2=previous_df, Selected_customer=selected_customers,
kpi_pg=kpi_choice, crs_map_pg=cross_mapping_choice, pop_pg=pop_flag, title_text=None
)
######## deleted full code
prs = ProductKPIMonthlyMtrxPage(prs, df_full)
# Export presentation to buffer
ppt_buffer = io.BytesIO()
prs.save(ppt_buffer)
# ppt_buffer.seek(0)
out = ppt_buffer.getvalue()
ppt_buffer.close()
if not out:
raise ValueError("Empty PPT bytes.")
return out
app creates bytes:
ppt_bytes = export_figures_to_ppt(
df_full = full_df, df= filtered_df, df_p1=current_df, df_p2=previous_df, Selected_customer=selected_customers,
kpi_pg=kpi_choice, crs_map_pg=cross_mapping_choice, pop_pg=pop_flag, title_text=None
)
download ppt
download_clicked = st.download_button(
label="📥 Download PPT Report",
\# data=st.session_state.ppt_bytes, # \*\*bytes\*\*, not buffer.getvalue() here
data = io.BytesIO(st.session_state.ppt_bytes),
file_name=f"{selected_customers}\_VR_Report.pptx",
mime="application/vnd.openxmlformats-officedocument.presentationml.presentation",
key="download_ppt",
)
facing the below error in my deployment:
KeyError: ‘3839159ec6ce96c4807bedb06fd3cfe8c0b14109109959171306008b’
2025-12-19 11:03:58.975
~~~~~~~~~~~~~~~~~^^^^^^^^^
2025-12-19 11:03:58.975
return self._files_by_id[file_id]
2025-12-19 11:03:58.975
File “/usr/local/lib/python3.12/site-packages/streamlit/runtime/memory_media_file_storage.py”, line 140, in get_file
2025-12-19 11:03:58.975
Traceback (most recent call last):
2025-12-19 11:03:58.975
2025-12-19 05:33:58.975 MediaFileHandler: Missing file 3839159ec6ce96c4807bedb06fd3cfe8c0b14109109959171306008b
2025-12-19 11:03:57.401
streamlit.runtime.media_file_storage.MediaFileStorageError: Bad filename ‘3839159ec6ce96c4807bedb06fd3cfe8c0b14109109959171306008b’. (No media file with id ‘3839159ec6ce96c4807bedb06fd3cfe8c0b14109109959171306008b’)
2025-12-19 11:03:57.401
raise MediaFileStorageError(
2025-12-19 11:03:57.401
File “/usr/local/lib/python3.12/site-packages/streamlit/runtime/memory_media_file_storage.py”, line 142, in get_file
2025-12-19 11:03:57.401
self._storage.get_file(absolute_path)
2025-12-19 11:03:57.401
File “/usr/local/lib/python3.12/site-packages/streamlit/web/server/media_file_handler.py”, line 95, in validate_absolute_path
2025-12-19 11:03:57.401
Traceback (most recent call last):
2025-12-19 11:03:57.401
2025-12-19 11:03:57.401
The above exception was the direct cause of the following exception:
Plz help me fix this bug.
Thanks