Console shows "Uncaught (in promise) TypeError: r is null" when updating a graph

I’m using Python and django-dash-plotly and I’ve encountered an obstacle which I haven’t been able to solve so far:

when plotting a certain graph using a callback function it works just fine. but when plotting an update to the graph the original graph remains and an error is shown on the console ( “Uncaught (in promise) TypeError: r is null”)

the error comes from Graph.react.js (original location)

    const figureClone = {
        **data: figure.data,**
        layout: this.getLayout(figure.layout, responsive),
        frames: figure.frames,
        config: configClone,
    };

and leads to async-graph.js (generated location):

var f={data:r.data,layout:this.getLayout(r.layout,u),frames:r.frames,config:l};

the graph is defined as follows:

dcc.Graph(
id=‘graph-content’,
style={‘flex’: ‘1’,
‘border’: ‘2px solid #FFFFFF’,
‘height’: ‘500px’
‘overflow’: ‘hidden’,
},

and here’s the callback function:

@app.callback(
Output(‘graph-content’, ‘figure’),
Input(‘selection’, ‘value’),
prevent_initial_call=True,
)
def start_analysis(selection):
fig = analyze()
return fig

The figure’s data in fig is complete and okay. Other graphs are updating just fine only this one doesn’t work.

Is this a bug or am I misssing something here?

edit: I can confirm now that this error doesn’t ocurring regularly. It disappears after restarting the hardware and after sometime it occurs again. There’s plenty of memory available and only 20% used hence I don’t think it’s a memory related issue