Id conflict and shiny 'server' function doesn't start, why?

I'd like to understand why a shiny app server doesn't start when there's a input/output id conflict?
In the following code, the "server started" msg is never printed...(the js console gives me the duplicate binding error).

Sorry if the info is explained elsewhere and thx for any help.


ui <- function() {

server <- function(input, output, session) {
      print("server started")
      output$cars <- renderTable(mtcars[1:3, 1:3])

shinyApp(ui = ui, server = server)

Hi, the issue is as you've noted that there's a name conflict; duplicate bindings don't work. There's a workaround suggested here:

thx for helping. but that's not really my question. I'd like to understand why the server function doesn't start in a id conflict? Or, why there's no server feedback on the error? I just don't get it.

personally, I use modules a lot and so there's no real blocking point. Just curiosity and also maybe, to be honest, the wish that shiny would pop an error to the console (even though, as I've written, I've developed the habit of checking the javascript console which does give an explicit error message).

Ah, sorry. Definitely one for someone like @jcheng...

The server function doesn't run when the app is started; it's run when a session is initiated (therefore it can run zero-to-many times over the course of a runApp()). A session is initiated after the browser retrieves the UI and all associated JS/CSS assets, and successfully binds all the inputs and outputs it finds. It's during this latter step that the duplicate binding error in the JS console occurs, and this throws an error that causes the entire init process to stop.

So I think the real question is why Shiny doesn't make it more obvious when a JavaScript error has occurred. To that question, I don't have a satisfying answer.


Thank you, understood.

Yes, some simple error message and invitation to check the js console would help newbies.