Dash Exception : Received value of type <class 'NoneType'>

Dash update error. How do I prevent dash to throw this exception when the Application - Tab is loaded?

Layout:

from dash.dash import no_update

               dbc.InputGroup(
                   [

                       
                       dbc.Input(
                                 id="b",
                                 persistence=True,
                                 persistence_type="memory"
                                ),

                        dbc.Input(
                                 id="r",
                                 persistence=True,
                                 persistence_type="memory"
                                ),

                      
                       dbc.Input(
                                 id="s",
                                 persistence=True,
                                 persistence_type="memory"
                                ),

                       
                       dbc.Input(
                                 id="u",
                                 persistence=True,
                                 persistence_type="memory"
                                ),
                   ],

                   id = "layout",

               ),

Callback:

@application.callback([

                        Output("b", "value"),
                        Output("r", "value"),
                        Output("s", "value"),
                        Output("u", "value")

                      ],
                      [
                        Input("input", "value")
                      ]
                     )
def details(input):

        # pull details

        return (details[0], details[1], details[2], details[3])

    else:

        return (no_update)

Traceback:

File "/Applications/Anaconda/anaconda3/lib/python3.9/site-packages/dash/_grouping.py", line 165, in check
    raise SchemaTypeValidationError(value, full_schema, path, expected_type)
dash._grouping.SchemaTypeValidationError: Schema: [<Output `b.value`>, <Output `r.value`>, <Output `s.value`>, <Output `u.value`>]
Path: ()
Expected type: (<class 'tuple'>, <class 'list'>)
Received value of type <class 'NoneType'>:

Hi,

If you donโ€™t want to trigger any updates in the callback, just raise dash.exceptions.PreventUpdate. Here is the link to the documentation about it:

https://dash.plotly.com/advanced-callbacks#catching-errors-with-preventupdate

Note that you can also prevent the update of some, but not necessarily all, outputs using dash.no_update. You might actually be trying to do that, however in this case you must return a tuple with the same length as the number of Output, not just a single value. Besides, you need to import dash.no_update or reference it right (I suspect your error is because no_update is not assigned).

Hope that this helps! :smiley: