ServersideOutput throws an error in circular callbacks

I have the following circular callback function where the elements of type op-data-store are used both as States and ServersideOutputs in the callback:

    Output("page-content", "children"),
    ServersideOutput({'type': 'op-data-store', 'index': ALL}, 'data'),

    Input("url", "pathname"),
    State({'type': 'op-data-store', 'index': ALL}, 'data')

The callback function throws the error: UnboundLocalError: local variable 'bkey_hash' referenced before assignment. However, the error goes away when ServersideOutput is changed to just Output. I need it be a ServersideOutput because elements of type op-data-store store images and ServersideOutput seems to be more efficient for image processing/rendering.

Would appreciate any help!

What versions of dash/dash-extensions are you using?

@Emil I think I was actually having a similar issue with dash-extensions if I remember correctly (wanted to use the MultiplexerTransform) that went away when I shifted over to vanilla Dash. Both were likely on the latest version as this was two weeks ago, but I’ll try to see if I can create an MRE for you to take a look at some time.

Update: Just saw the post directly beneath this one in my feed about likely the same issue that I faced, so I’ll try out DashBlueprints and see if that solves things. :slight_smile:

I am asking about the version as this error is known to happen for paticular older dash-extensions versions and/or caches created with them. To resolve the issue, update to the latest versions of Dash and dash-extensions, and clear any old cache (e.g. folders on disk).

The issue is related to a 3rd party libary doing the caching. Hence, it will go away if you switch to vanilla Dash, as caching won’t be used in this case.

1 Like

Got it! Will try to take a look at those things and see if the error goes away. Thanks!

1 Like

Hi @Emil, I’m still getting the error. I’m using the following versions, which I believe are the latest:

dash                    2.6.2    
dash-extensions         0.1.6 

I also cleared the temporary files cache on my Windows computer using using Disk Cleanup.
Would appreciate any help!

Did you delete any files on disk? Per default, a folder I created next to the app.

Hi @Emil, I did not delete any files. The only files I deleted were temporary files on my disk, but I get the error regardless of whether I do the disk cleanup.

It is not the temp files, which needs to be deleted, it is the folder that I was talking about in the previous post. Hence, until you delete it, you might see the error due to old, corrupt caching data.

Hi @Emil sorry I’m a little confused. Which folder is this? Where is it?