It is and I can use add_segments from plotly as well, but for my purpose it's preferable to do It from the layout definition since I'd like to do 'relayout' in shiny.
I tried to track down what triggers the error, but could only trace it as far as a function called ggplotly.ggplot() by first running debug(ggplotly), then executing your sample code, and walking through the execution. You could try to add more debug() calls to dig further and find the first place the error gets triggered; that might help someone with more knowledge of plotly (which is new to me) to diagnose the issue?
Thank You so much!
By the way, I love your book on plotly in R and I'm trying to implement the proxies in my Shiny App. The alternative was to add and delete trace every time I want to change the position of the vertical line.