Ignore an alert: 'Bad message format'

Hello everyone, I’m new here. I hope you all are doing fine.
So, I implemented streamlit with my code for an Information retrieval system. At first I had many problems to hide the text input and the search button after clicking it to only show the document clicked. But then I managed to do that using beta containers. Now my problem is after clicking the button, the required work is done.


But I get an alert in browser titled ‘Bad message format’ and saying " ‘setIn’ cannot be called on an ElementNode ".

this is the code I used:
5

So, I just want to ignore the alert if possible. I tried the try except solution but it would not work as the with statement does the same.

Thank you for reading my request.

2 Likes

Hi @Walid_Moghrane, welcome to the Streamlit community!

If I’m not mistaken, this was a bug fixed in a patch release. Could you update Streamlit and see if that fixes your issue?

Best,
Randy

Hello @randyzwitch , thanks for replying to my topic.
This is the version of Streamlit I have installed:

vers

Best,

The problem is still there, I wish that someone helps with this. As I have an appointment soon, and I have to submit it before a certain date.
Thanks

1 Like

Hi, I also run into this error but can’t understand what it means so i can try to fix my code.
so, what is the meaning of the message? Why there is no debug information when it occurs?
Thanks!

I got the same ‘Bad message format!’

Got the same error on current stable 0.79. Started showing when using the beta.container().

Just pinging this thread, still seems to be unresolved.

1 Like

Hi, I am having the same bug here. I have attached a GIst which is hopefully reproducible. I am using Streamlit version 0.80.0, python 3.8.5, pip 20.0.2, Ubuntu 20.04

1 Like

@Walid_Moghrane @randyzwitch
Hi, I just met this problem a few days ago
This error report from my browser is after I updated the version of chrome explorer.

My solution is restart the streamlit app with “streamlit run yourstreamlitapp.py”, and refresh the web page, problem was disappear.

Try to do this, hope problem can be solved.

this doesn’t work for the gist posted above

1 Like

If you need to demo your App, a temporary workaround could be opening the network URL in firefox. I tried this, the pop-up does not appear in Firefox!

Hi Sarah! Welcome to the Streamlit community!! :tada: :partying_face: :tada:

I was able to reproduce the error with @mihir’s gist on Firefox when I tried deleting an entry in the sidebar. See:

I’ll relay this bug to our engineering team. Thanks for bringing it to our attention!

Best, :balloon:
Snehan

2 Likes

Any update on this issue… I am facing the same when I display new page after hiding previous elements. I am new to streamlit… perhaps there could be something I am doing the wrong way.

Hi @Manu, thanks for your patience! :slightly_smiling_face:

I just opened a new issue for this bug that you can track on Github. It may take some time to triage it and get it into the pipeline.

Best, :balloon:
Snehan

Here is another interesting case I encountered while dev-ing an app. You can see here.

Basically, it had a login form. I used -

form = st.form(key='my-form')
username = form.text_input("Username")
password = form.text_input("Password")
twoFA = form.text_input("2FA")
submit = form.form_submit_button('Submit')

So,

I used this -

text4 = st.empty()
with text4.beta_container():
    st.text('Method 1: Put Your Credentials to log in.')

    form = st.form(key='my-form')
    username = form.text_input("Username")
    password = form.text_input("Password")
    twoFA = form.text_input("2FA")
    submit = form.form_submit_button('Submit')

    submit = False
    st.text('Method 2: Check account positions clicking buttons')
    if st.button("Show me Amit's One Acccount"):
        username = 'S'
        password = 'K@K'
        twoFA='K'
        submit = True

if submit:
    text4.empty()

Basically a hacky solution which is straight forward from the documentation as you can see here -
https://docs.streamlit.io/en/0.82.0/api.html#placeholders-help-and-options

That’s when I landed in the error.

Well, it was just error but it was working correctly after the error but as I was dev-ing production level app, it is quite nightmare actually.

The rest of the elements have been dealt with st.empty() 's hacky usage without complain.

But, then again -

submit = False

text9 = st.empty()

with text9.form(key='my-form'):
    username = st.text_input("Username")
    password = st.text_input("Password")
    twoFA = st.text_input("2FA")
    submit = st.form_submit_button('Submit')

if submit:
    text9.empty()

This is again throwing error.

Other elements like -

submit = False

text9 = st.empty()

if text9 .button("Show me Amit's One Acccount"):
        username = 'S'
        password = 'K@K'
        twoFA='K'
        submit = True

if submit:
    text9.empty()

This is not throwing any error.

So, I had to replace the form elements into three text inputs and a button and made it work.

I am seeing the same error on version 85.1. Is there any plan to fix this?

i got the same error today, when you import functions from other py file , and the py file which you import use st.columns() or st.beta_columns() than you will get the error. just donot use the function, then all will be gone.

1 Like