# Inconsistent Callback Error Updating Scatter Plot

**URL:** <https://community.plotly.com/t/inconsistent-callback-error-updating-scatter-plot/46754>\
**Category:** Dash Python\
**Created:** [November 2, 2020, 4:51pm UTC](https://community.plotly.com/t/inconsistent-callback-error-updating-scatter-plot/46754 "2020-11-02T16:51:15Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![LeoWY](https://avatars.discourse-cdn.com/v4/letter/l/b5ac83/32.png) [@LeoWY](https://community.plotly.com/u/LeoWY)\
**Post date:** [November 22, 2021, 2:45pm UTC](https://community.plotly.com/t/inconsistent-callback-error-updating-scatter-plot/46754/8 "2021-11-22T14:45:35Z")

</div>

Hi,

I might have found a hack :

```python
try:
    fig = px.scatter(...)
except Exception:
    fig = px.scatter(...) # Exact same line as previously
return fig

```

It works in for me in development, and I’ll try later in production.

The idea behind is that it works randomly at the first attempt but always works on the second (e.g. when refreshing the page). Here I don’t wait for a refresh and force the second attempt in the `except` part.

On my trials to fix it, I also added `prevent_initial_callback=True` to some of the `@app.callback(...)` because callbacks producing plotly figures are called whenever a `dcc.Store` data attribute changes. Thus I make sure that callbacks for plotting figures are not triggered before data is maid available.

Let me know if it’s working for you.

---

_[View the full topic](https://community.plotly.com/t/inconsistent-callback-error-updating-scatter-plot/46754)._
