Dash selectively dislikes certain variables

Hello! I’m having an issue where a callback I’ve written will only return if I do not include certain variables.

The return statement is like this:

return [graphs['charge_current_graph'], graphs['charge_temperature_graph'], graphs['charge_time_graph'],
        graphs['height_of_charge_graph'], graphs['charge_99_trend_graph'], graphs['discharge_current_graph'], 
        graphs['discharge_temperature_graph'], graphs['discharge_time_graph'], graphs['depth_of_discharge_graph'], 
        graphs['discharge_9_trend_graph'], version_information, fault_counts, fault_history, hours_information, None]

The variables in question are version_information, fault_counts, and fault_history. They are all three dictionaries that are returned to dcc.Store components, while all previous values are returned to dcc.Graph figures, and the final two are returned to html.Div children.

If I rewrite the return statement to be this:

return [graphs['charge_current_graph'], graphs['charge_temperature_graph'], graphs['charge_time_graph'],
        graphs['height_of_charge_graph'], graphs['charge_99_trend_graph'], graphs['discharge_current_graph'], 
        graphs['discharge_temperature_graph'], graphs['discharge_time_graph'], graphs['depth_of_discharge_graph'], 
        graphs['discharge_9_trend_graph'], None, None, None, hours_information, None]

or even like:

return [graphs['charge_current_graph'], graphs['charge_temperature_graph'], graphs['charge_time_graph'],
        graphs['height_of_charge_graph'], graphs['charge_99_trend_graph'], graphs['discharge_current_graph'], 
        graphs['discharge_temperature_graph'], graphs['discharge_time_graph'], graphs['depth_of_discharge_graph'], 
        graphs['discharge_9_trend_graph'], dict(), dict(), dict(), hours_information, None]

The function will return fine. But if I try to return those variables, I get this Error.

I have no idea at all why includeing those dictionaries as variable names would cause this error to suddenly appear. Does anyone know if this is a bug? Please let me know if I need to supply more information.

Thank you!

I’ve found the issue! You see the return value one of the internal values in these dictionaries was of type google.protobuf.internal.containers.RepeatedFieldContainer which is not something Dash gets along with. casting this container as a list fixed the issue.

The moral of the story is to check what types your nested objects are when making your callbacks! Hope his helps someone in the future.