Learn how to use Dash Bio for next-gen sequencing & quality control. 🧬Register for the Oct 27 webinar.

Suppress Callback Exceptions not working for States?

Hi all,

I’m running into an issue where setting suppress_callback_exceptions works for ignoring callbacks with missing Inputs, but not for callbacks with missing States (I.e. you have a callback with all the Inputs defined and rendered in the app layout, but one or more States isn’t rendered yet).

I have a small example of this here:

import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State

# Configure app
app = dash.Dash(
    __name__,
    meta_tags=[{'name': 'viewport', 'content': 'width=device_width'}]
)
app.config.suppress_callback_exceptions = True

# Layout
app.layout = html.Div(
    [
        # Comment this out to cause an "Error loading dependencies" error
        dcc.Store(id='some-store'),

        # Comment this whole button out along with the Store to fix
        # the dependencies error
        html.Button(
            "Do something",
            id='do-something'
        ),

        html.Div(
            html.H1("Did something!"),
            id='did-something-container',
            hidden=True
        )
    ]
)


# Callbacks
@app.callback(
    Output('did-something-container', 'hidden'),

    [Input('do-something', 'n_clicks')],
    [State('some-store', 'data')]
)
def update_header(clicks, data):
    if not clicks:
        return True
    else:
        return False


if __name__ == "__main__":
    app.run_server(debug=True, dev_tools_silence_routes_logging=True)

If you comment out the dcc.Store, you get an Error loading dependencies message when you load the page. However, if you comment out both the dcc.Store and the html.Button, everything loads just fine.

Is this the expected behavior of suppress_callback_exceptions? If so, is there any workaround for the situation I’m encountering?

Hey Zach,

I just ran into this issue. Were you able to find a solution?