Subject: Streamlit Community Cloud: top-level secret saved but absent at runtime

Subject: Streamlit Community Cloud: top-level secret saved but absent at runtime

Hello Streamlit team,

I have a private Streamlit Community Cloud app running Streamlit 1.65.0 on Python 3.12.

A top-level TOML setting is saved in the deployed app’s Settings → Secrets:

MARKETLAB_ENABLE_OIDC_PROBE = true

It is located before the [auth] section. I have confirmed that the setting remains present after reopening the Secrets editor, saving again, and rebooting the app.

However, the application cannot find this key in either st.secrets or os.environ.

The latest diagnostic output is:

OIDC flag diagnostics: source=missing secrets_status=absent present=no type=bool enabled=no
OIDC route selected: research

The app otherwise starts normally.

Could you help determine why a saved top-level secret is not available to the running application? Is there a known configuration synchronization issue or another setting that should be checked?

I can provide deployment details privately if needed. No credential values will be shared.

Welcome to the Streamlit community, and thanks for your detailed question! :balloon: If a top-level secret like MARKETLAB_ENABLE_OIDC_PROBE = true is present in your app’s Secrets panel but missing from both st.secrets and os.environ at runtime, the most common causes are TOML formatting issues, type handling, or a platform-side caching/desync problem. Streamlit expects secrets in TOML format, and top-level keys should be accessible via both st.secrets["MARKETLAB_ENABLE_OIDC_PROBE"] and os.environ["MARKETLAB_ENABLE_OIDC_PROBE"] (as a string, not a boolean). However, TOML booleans (true/false) are not promoted to environment variables—only strings, ints, and floats are—so os.environ will not have this key if its value is a boolean. You should still be able to access it via st.secrets.

If st.secrets["MARKETLAB_ENABLE_OIDC_PROBE"] is also missing, double-check for typos, TOML syntax errors, or accidental placement inside a section. Try changing the value to a string (MARKETLAB_ENABLE_OIDC_PROBE = "true") and see if it appears in both st.secrets and os.environ. If the issue persists after rebooting, it may be a rare platform-side sync issue—removing and re-adding the secret, or redeploying the app, can sometimes resolve this. For more, see Secrets management for your Community Cloud app and TOML file format. Please share a minimum reproducible example (with sensitive info redacted) if you’d like more help debugging, and let the community know if you spot anything odd in your secrets structure!

Sources: