modeBarButtonsToAdd doesn't appear to be working as intended

Hello, It appears that when I attempt to add the ‘select2d’ button to the modebar on a ScatterMapBox I get an error stating “must provide button ‘name’ in button config”. Not sure where this issue is coming from to be honest. Can anyone point out what I’m missing here?

Here is the Code

app.layout = html.Div(
                            'data': [go.Scattermapbox()],
                            'layout': go.Layout(
                          config={'modeBarButtonsToAdd': ["select2d"]}
            ], className="pretty_container"

Edit: I should clarify that modeBarButtonstoRemove seems to work just fine. I can remove any buttons I want from the modebar. Since syntactically these actions are similar I don’t see why adding buttons would fail. I also wanted to include a photo of the error. If I need to add anymore code please let me know.

Edit2: So I’ve been trying different things and I’ve noticed that if I pass an empty list

config={'modeBarButtonsToAdd': []}

Then the graph will render, just without the button I want. But as soon as I try to add a button that is there by default, pan2d, then it throws the same "must provide button ‘name’ in button config’ error. Somehow modeBarButtonsToAdd doesn’t know any of the button names I think. Does anyone know how to I can fix this? Should this be reported as bug or something?

I’ve found the solution. I feel silly but I honestly thought that modeBarButtonsToAdd could just add a default button to the modebar, but I was incorrect. It actually allows you to add custom buttons or something? I’m not sure. But I was able to get what I wanted by doing this.

config={'modeBarButtons': [['pan2d','select2d']]} 

This allows me to have the select option on the graph even if there are no points on it. Which is all I wanted.

Your solution works if you remove buttons only, but what about adding new buttons? For example if you try to add the buttons for interactive annotations and shape drawing in plotly figures, it prevents the plot to be shown at all!

import plotly.offline as offline
import as px
df =
fig = px.scatter(df, x='petal_width', y='sepal_length', color='species')
    title_text='Draw a path to separate versicolor and virginica'

config = dict({'scrollZoom': True,'displaylogo': False, 'modeBarButtonsToAdd':['drawline','drawopenpath','drawcircle','drawrect','eraseshape']}) 

                     auto_open=True, image = None, config =config, 
                     filename='./foo.html', include_plotlyjs='directory')

If you try setting the configuration to

config = dict({'scrollZoom': True,'displaylogo': False})

you are able to see the plot again: why it doesn’t work??

Please, this
and also