Hiding tracebacks and errors doesn't work!


When showErrorDetails = false in the configuration file, the expected behaviour is to hide the tracebacks and show a generic error. This is not what is happening at the moment where only the summary of the error message gets obfuscated.

For example I am trying to access GPT 4 via the API, from an account that does not have access to it. With showErrorDetails = false I get back:

openai.error.InvalidRequestError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you're on Streamlit Cloud, click on 'Manage app' in the lower right of your app).


... Full traceback...

Any idea how I can stop this behaviour and hide all details being shown, including the type of error, eg. the openai.error.InvalidRequestError? Showing the traceback is very risky in a prod environment, especially for client-facing apps.

Debug info

  • Streamlit version: 1.25.0
  • Python version: 3.10.4
  • PyEnv & Poetry
  • OS version: MacOS 13.4.1 (22F82)
  • Browser version: Chrome 114.0.5735.198

Requirements file

python = β€œ3.10.4”
streamlit = β€œ^1.25.0”
openai = β€œ^0.27.9”
streamlit-chat = β€œ^0.1.1”
python-dotenv = β€œ^1.0.0”
boto3 = β€œ^1.28.36”
extra-streamlit-components = β€œ^0.1.60”

Hey please check out this thread of StreamLit Github issue
This should solve your problem

Thanks! It seems like there is no official solution yet to this issue, but at least it’s recognised as a bug. Fingers crossed we will have a fix soon.

Ah yes, will update you if I get to know anything

this code work’s for me :

not showing traceback

sql = β€œcall upsert_transac(%s,%s,%s,%s,%s)”
val = (pilih[0],pilih[1],pilih[3],tmpjml,st.session_state[β€˜hantu’])
except KeyError:
except Exception as e:
st.error(f"mainkan: {e}")

read from store procedure