ValueError("Invalid value") in basedatatypes.py

After upgrading to Plotly 5 (either 5.1.0 or 5.2.2), I am seeing the error (given below) for various plots, at random. The issue goes away if Plotly is downgraded to 4.14.3.

File "plotly/basedatatypes.py", line 3952, in _index_is
raise ValueError("Invalid value")

Unfortunately, I do not have a simple reproducible example to open an issue, but here is the description of the problem.

I have a Dash app that plots several graphs. When the Dash app starts, some plots do not get displayed, and I see the error. This only occurs on the initial startup of the app. When the webpage is refreshed, the error does not re-appear, and all plots get displayed without errors.

If I downgrade to Plotly 4.14.3, the issue goes away entirely.

Any ideas what might be causing this?

I am using plotly (online) in a Flask App running with mod_wsgi on an Apache server and I get exactly the same error, randomly also with the latest Plotly version (5.3.1).

Downgrading to 4.14.3 does not help.

So far I can judge, the error also only seems to appear after a server restart. The error also appears for the first plotly graph I try to plot on the webpage (I am plotting several Plotly plots on the page).

I am encountering this issue as well while using Plotly (5.3.1) with Dash (2.0.0). I checked all the data points that I supply to the graph, and they are all float values, i.e. should all be valid. So I have no clue how to debug this other than joining the above users.

There are other reports of this issue:

If you could provide some runnable code for us to look at, it would go a long way towards finding and fixing this issue! :slight_smile:

I think I have a more or less reproducible example. Please see ValueError(“Invalid value”) in basedatatypes.py · Issue #3441 · plotly/plotly.py · GitHub

I might have found a hack, let me know if it’s working for you :slight_smile:

Hehe, sneaky! I am sure it will work, but I will only be able to try it in a few days. And I also do not want to hinge me upgrading Plotly on this sort of a hack. I am hoping it will be addressed properly.

I have updated the GitHub issue though with more links to this forum.

Well, I have finally made the decision to migrate to Dash 2.0 and Plotly 5.5.0, and therefore had to implement the hack with try on every graph (as was suggested by @LeoWY), and it worked well.

try:
fig = …
except ValueError::
fig = …

@nicolaskruchten were you able to reproduce the issue by following the example I provided here ValueError(“Invalid value”) in basedatatypes.py · Issue #3441 · plotly/plotly.py · GitHub ?