Shiny: nested eventReactive silent `error:`

Created on 8 Feb 2017  ·  8Comments  ·  Source: rstudio/shiny

the code below has a nested eventReactive call. where buttons activate eventReactive that is then used in another one.

i get a silent error that i can only see when i step into the last eventReactive. shiny tries to solve the issue by not crashing but returning that no event was taken, which is not the case when there are 2 events i want to track.

is there a way to work around this silent error problem?

library(shiny)
library(shinyAce)
shinyApp(
  ui = fluidPage(
    sidebarPanel(
          uiOutput('x1'),
          uiOutput('x2')),
mainPanel(
           actionButton("buttonA", "button a"),
           actionButton("buttonB", "button b")

    )
  ),
  server = function(input, output) {


    a<-reactive({
      input$buttonA
    })

    a1<-reactive({
      input$buttonB
    })


    b<-eventReactive(a(),{
      4*5
    })

    b1<-eventReactive(a1(),{
      3*5
    })


    d<-eventReactive({
      browser()
      x=list(b(),b1())

    },{
      a1<-2
      b1<-4
      list(a1=a1,b1=b1)
    })


    output$x1<-renderUI({
      layerTxt=d()$a1
      aceEditor(outputId = 'layerAce',value=layerTxt,
                mode = "r", theme = "chrome", 
                height = "100px", fontSize = 12,wordWrap = T)
    })  

    output$x2<-renderUI({
      themeTxt=d()$b1
      aceEditor(outputId = 'themeAce',value=themeTxt,
                mode = "r", theme = "chrome", 
                height = "100px", fontSize = 12,wordWrap = T)
    })  

  }
)
Advanced Low Type

All 8 comments

@yonicd Is it possible to provide a simplified version of the code? It's not clear to me what exactly the question or problem is, so a more detailed explanation would also be helpful.

sorry, that is the simplest version of the problem as far as i can create one.

an explanation would be to assume that you have an eventReactive (eR1) that is conditioned on two objects. they are themselves eventReactive (eR2,eR3) and are triggered by actionButtons (aB1,aB2). until both buttons are clicked any call to eR1 will be thrown to a silent error by shiny.

does that make more sense?

Hi, I wasn't able to reproduce this, but I wasn't also entirely sure how to reproduce it. When you have a spare moment, would you please confirm this is still an issue, and if it is, perhaps elaborate on how I should reproduce?

Thanks, and sorry to take so long to get back to you.

to say the truth it been a while. I just reran the code i used in original issue comment and the error still is there. when the browser invokes try to run b().

> library(shiny)
> library(shinyAce)
> shinyApp(
+   ui = fluidPage(
+     sidebarPanel(
+       uiOutput('x1'),
+       uiOutput('x2')),
+     mainPanel(
+       actionButton("buttonA", "button a"),
+       actionButton("buttonB", "button b")
+       
+     )
+   ),
+   server = function(input, output) {
+     
+     
+     a<-reactive({
+       input$buttonA
+     })
+     
+     a1<-reactive({
+       input$buttonB
+     })
+     
+     
+     b<-eventReactive(a(),{
+       4*5
+     })
+     
+     b1<-eventReactive(a1(),{
+       3*5
+     })
+     
+     
+     d<-eventReactive({
+       browser()
+       x=list(b(),b1())
+       
+     },{
+       a1<-2
+       b1<-4
+       list(a1=a1,b1=b1)
+     })
+     
+     
+     output$x1<-renderUI({
+       layerTxt=d()$a1
+       aceEditor(outputId = 'layerAce',value=layerTxt,
+                 mode = "r", theme = "chrome", 
+                 height = "100px", fontSize = 12,wordWrap = T)
+     })  
+     
+     output$x2<-renderUI({
+       themeTxt=d()$b1
+       aceEditor(outputId = 'themeAce',value=themeTxt,
+                 mode = "r", theme = "chrome", 
+                 height = "100px", fontSize = 12,wordWrap = T)
+     })  
+     
+   }
+ )

Listening on http://127.0.0.1:6043
Called from: eventReactiveExpr(...)
Browse[1]> b()
Error: 
Called from: value[[3L]](cond)


.traceback(1)

[[1]]
[1] "eval(substitute(browser(skipCalls = pos), list(pos = (length(sys.frames()) - "
[2] "    frame) + 2)), envir = sys.frame(frame))"                                  

[[2]]
[1] "eval(substitute(browser(skipCalls = pos), list(pos = (length(sys.frames()) - "
[2] "    frame) + 2)), envir = sys.frame(frame))"                                  

[[3]]
[1] ".rs.breakOnError(TRUE)"

[[4]]
[1] "(function () "              "{"                          "    .rs.breakOnError(TRUE)"
[4] "})()"                      

[[5]]
[1] "stop(e)"

[[6]]
[1] "value[[3L]](cond)"

[[7]]
[1] "tryCatchOne(expr, names, parentenv, handlers[[1L]])"

[[8]]
[1] "tryCatchList(expr, classes, parentenv, handlers)"

[[9]]
 [1] "tryCatch({"                                                             
 [2] "    captureStackTraces({"                                               
 [3] "        result <- withVisible(force(expr))"                             
 [4] "        if (promises::is.promising(result$value)) {"                    
 [5] "            p <- promise_chain(setVisible(result), ..., catch = catch, "
 [6] "                finally = finally)"                                     
 [7] "            runFinally <- FALSE"                                        
 [8] "            p"                                                          
 [9] "        }"                                                              
[10] "        else {"                                                         
[11] "            result <- Reduce(function(v, func) {"                       
[12] "                if (\".visible\" %in% names(formals(func))) {"          
[13] "                  withVisible(func(v$value, .visible = v$visible))"     
[14] "                }"                                                      
[15] "                else {"                                                 
[16] "                  withVisible(func(v$value))"                           
[17] "                }"                                                      
[18] "            }, list(...), result)"                                      
[19] "            setVisible(result)"                                         
[20] "        }"                                                              
[21] "    })"                                                                 
[22] "}, error = function(e) {"                                               
[23] "    if (!is.null(catch)) "                                              
[24] "        catch(e)"                                                       
[25] "    else stop(e)"                                                       
[26] "}, finally = if (runFinally && !is.null(finally)) finally())"           

[[10]]
[1] "do()"

[[11]]
[1] "hybrid_chain(eventFunc(), function(value) {" "    if (ignoreInit && !initialized) {"      
[3] "        initialized <<- TRUE"                "        req(FALSE)"                         
[5] "    }"                                       "    req(!ignoreNULL || !isNullEvent(value))"
[7] "    isolate(handlerFunc())"                  "})"                                         

[[12]]
[1] "`<reactive:eventReactive(a())>`(...)"

[[13]]
[1] ".func()"

[[14]]
[1] "withVisible(.func())"

[[15]]
[1] "withCallingHandlers({"       "    .error <<- FALSE"        "    withVisible(.func())"   
[4] "}, error = function(cond) {" "    .value <<- cond"         "    .error <<- TRUE"        
[7] "    .visible <<- FALSE"      "})"                         

[[16]]
[1] "contextFunc()"

[[17]]
[1] "env$runWith(self, func)"

[[18]]
[1] "force(expr)"

[[19]]
[1] "globals$domain$wrapSync(expr)"

[[20]]
[1] "promises::with_promise_domain(createVarPromiseDomain(.globals, "
[2] "    \"domain\", domain), expr)"                                 

[[21]]
[1] "withReactiveDomain(.domain, {"                  
[2] "    env <- .getReactiveEnvironment()"           
[3] "    .graphEnterContext(id)"                     
[4] "    on.exit({"                                  
[5] "        .graphExitContext(id, domain = .domain)"
[6] "    }, add = TRUE)"                             
[7] "    env$runWith(self, func)"                    
[8] "})"                                             

[[22]]
[1] "globals$domain$wrapSync(expr)"

[[23]]
 [1] "promises::with_promise_domain(reactivePromiseDomain(), {"
 [2] "    withReactiveDomain(.domain, {"                       
 [3] "        env <- .getReactiveEnvironment()"                
 [4] "        .graphEnterContext(id)"                          
 [5] "        on.exit({"                                       
 [6] "            .graphExitContext(id, domain = .domain)"     
 [7] "        }, add = TRUE)"                                  
 [8] "        env$runWith(self, func)"                         
 [9] "    })"                                                  
[10] "})"                                                      

[[24]]
 [1] "ctx$run(function() {"                "    result <- withCallingHandlers({"
 [3] "        .error <<- FALSE"            "        withVisible(.func())"       
 [5] "    }, error = function(cond) {"     "        .value <<- cond"            
 [7] "        .error <<- TRUE"             "        .visible <<- FALSE"         
 [9] "    })"                              "    .value <<- result$value"        
[11] "    .visible <<- result$visible"     "})"                                 

[[25]]
[1] "self$.updateValue()"

[[26]]
[1] "..stacktraceoff..(self$.updateValue())"

[[27]]
[1] "b()"

[[28]]
[1] "eventReactiveExpr(...)"

[[29]]
[1] "..stacktraceon..(eventReactiveExpr(...))"

[[30]]
[1] "eventFunc()"

[[31]]
[1] "force(expr)"

[[32]]
[1] "withVisible(force(expr))"

[[33]]
[1] "withCallingHandlers(expr, error = doCaptureStack)"

[[34]]
[1] "globals$domain$wrapSync(expr)"

[[35]]
[1] "promises::with_promise_domain(createStackTracePromiseDomain(), "
[2] "    expr)"                                                      

[[36]]
 [1] "captureStackTraces({"                                               
 [2] "    result <- withVisible(force(expr))"                             
 [3] "    if (promises::is.promising(result$value)) {"                    
 [4] "        p <- promise_chain(setVisible(result), ..., catch = catch, "
 [5] "            finally = finally)"                                     
 [6] "        runFinally <- FALSE"                                        
 [7] "        p"                                                          
 [8] "    }"                                                              
 [9] "    else {"                                                         
[10] "        result <- Reduce(function(v, func) {"                       
[11] "            if (\".visible\" %in% names(formals(func))) {"          
[12] "                withVisible(func(v$value, .visible = v$visible))"   
[13] "            }"                                                      
[14] "            else {"                                                 
[15] "                withVisible(func(v$value))"                         
[16] "            }"                                                      
[17] "        }, list(...), result)"                                      
[18] "        setVisible(result)"                                         
[19] "    }"                                                              
[20] "})"                                                                 

[[37]]
[1] "doTryCatch(return(expr), name, parentenv, handler)"

[[38]]
[1] "tryCatchOne(expr, names, parentenv, handlers[[1L]])"

[[39]]
[1] "tryCatchList(expr, classes, parentenv, handlers)"

[[40]]
 [1] "tryCatch({"                                                             
 [2] "    captureStackTraces({"                                               
 [3] "        result <- withVisible(force(expr))"                             
 [4] "        if (promises::is.promising(result$value)) {"                    
 [5] "            p <- promise_chain(setVisible(result), ..., catch = catch, "
 [6] "                finally = finally)"                                     
 [7] "            runFinally <- FALSE"                                        
 [8] "            p"                                                          
 [9] "        }"                                                              
[10] "        else {"                                                         
[11] "            result <- Reduce(function(v, func) {"                       
[12] "                if (\".visible\" %in% names(formals(func))) {"          
[13] "                  withVisible(func(v$value, .visible = v$visible))"     
[14] "                }"                                                      
[15] "                else {"                                                 
[16] "                  withVisible(func(v$value))"                           
[17] "                }"                                                      
[18] "            }, list(...), result)"                                      
[19] "            setVisible(result)"                                         
[20] "        }"                                                              
[21] "    })"                                                                 
[22] "}, error = function(e) {"                                               
[23] "    if (!is.null(catch)) "                                              
[24] "        catch(e)"                                                       
[25] "    else stop(e)"                                                       
[26] "}, finally = if (runFinally && !is.null(finally)) finally())"           

[[41]]
[1] "do()"

[[42]]
[1] "hybrid_chain(eventFunc(), function(value) {" "    if (ignoreInit && !initialized) {"      
[3] "        initialized <<- TRUE"                "        req(FALSE)"                         
[5] "    }"                                       "    req(!ignoreNULL || !isNullEvent(value))"
[7] "    isolate(handlerFunc())"                  "})"                                         

[[43]]
[1] "`<reactive>`(...)"

[[44]]
[1] ".func()"

[[45]]
[1] "withVisible(.func())"

[[46]]
[1] "withCallingHandlers({"       "    .error <<- FALSE"        "    withVisible(.func())"   
[4] "}, error = function(cond) {" "    .value <<- cond"         "    .error <<- TRUE"        
[7] "    .visible <<- FALSE"      "})"                         

[[47]]
[1] "contextFunc()"

[[48]]
[1] "env$runWith(self, func)"

[[49]]
[1] "force(expr)"

[[50]]
[1] "globals$domain$wrapSync(expr)"

[[51]]
[1] "promises::with_promise_domain(createVarPromiseDomain(.globals, "
[2] "    \"domain\", domain), expr)"                                 

[[52]]
[1] "withReactiveDomain(.domain, {"                  
[2] "    env <- .getReactiveEnvironment()"           
[3] "    .graphEnterContext(id)"                     
[4] "    on.exit({"                                  
[5] "        .graphExitContext(id, domain = .domain)"
[6] "    }, add = TRUE)"                             
[7] "    env$runWith(self, func)"                    
[8] "})"                                             

[[53]]
[1] "globals$domain$wrapSync(expr)"

[[54]]
 [1] "promises::with_promise_domain(reactivePromiseDomain(), {"
 [2] "    withReactiveDomain(.domain, {"                       
 [3] "        env <- .getReactiveEnvironment()"                
 [4] "        .graphEnterContext(id)"                          
 [5] "        on.exit({"                                       
 [6] "            .graphExitContext(id, domain = .domain)"     
 [7] "        }, add = TRUE)"                                  
 [8] "        env$runWith(self, func)"                         
 [9] "    })"                                                  
[10] "})"                                                      

[[55]]
 [1] "ctx$run(function() {"                "    result <- withCallingHandlers({"
 [3] "        .error <<- FALSE"            "        withVisible(.func())"       
 [5] "    }, error = function(cond) {"     "        .value <<- cond"            
 [7] "        .error <<- TRUE"             "        .visible <<- FALSE"         
 [9] "    })"                              "    .value <<- result$value"        
[11] "    .visible <<- result$visible"     "})"                                 

[[56]]
[1] "self$.updateValue()"

[[57]]
[1] "..stacktraceoff..(self$.updateValue())"

[[58]]
[1] "d()"

[[59]]
[1] "renderUI(...)"

[[60]]
[1] "func()"

[[61]]
[1] "force(expr)"

[[62]]
[1] "withVisible(force(expr))"

[[63]]
[1] "withCallingHandlers(expr, error = doCaptureStack)"

[[64]]
[1] "globals$domain$wrapSync(expr)"

[[65]]
[1] "promises::with_promise_domain(createStackTracePromiseDomain(), "
[2] "    expr)"                                                      

[[66]]
 [1] "captureStackTraces({"                                               
 [2] "    result <- withVisible(force(expr))"                             
 [3] "    if (promises::is.promising(result$value)) {"                    
 [4] "        p <- promise_chain(setVisible(result), ..., catch = catch, "
 [5] "            finally = finally)"                                     
 [6] "        runFinally <- FALSE"                                        
 [7] "        p"                                                          
 [8] "    }"                                                              
 [9] "    else {"                                                         
[10] "        result <- Reduce(function(v, func) {"                       
[11] "            if (\".visible\" %in% names(formals(func))) {"          
[12] "                withVisible(func(v$value, .visible = v$visible))"   
[13] "            }"                                                      
[14] "            else {"                                                 
[15] "                withVisible(func(v$value))"                         
[16] "            }"                                                      
[17] "        }, list(...), result)"                                      
[18] "        setVisible(result)"                                         
[19] "    }"                                                              
[20] "})"                                                                 

[[67]]
[1] "doTryCatch(return(expr), name, parentenv, handler)"

[[68]]
[1] "tryCatchOne(expr, names, parentenv, handlers[[1L]])"

[[69]]
[1] "tryCatchList(expr, classes, parentenv, handlers)"

[[70]]
 [1] "tryCatch({"                                                             
 [2] "    captureStackTraces({"                                               
 [3] "        result <- withVisible(force(expr))"                             
 [4] "        if (promises::is.promising(result$value)) {"                    
 [5] "            p <- promise_chain(setVisible(result), ..., catch = catch, "
 [6] "                finally = finally)"                                     
 [7] "            runFinally <- FALSE"                                        
 [8] "            p"                                                          
 [9] "        }"                                                              
[10] "        else {"                                                         
[11] "            result <- Reduce(function(v, func) {"                       
[12] "                if (\".visible\" %in% names(formals(func))) {"          
[13] "                  withVisible(func(v$value, .visible = v$visible))"     
[14] "                }"                                                      
[15] "                else {"                                                 
[16] "                  withVisible(func(v$value))"                           
[17] "                }"                                                      
[18] "            }, list(...), result)"                                      
[19] "            setVisible(result)"                                         
[20] "        }"                                                              
[21] "    })"                                                                 
[22] "}, error = function(e) {"                                               
[23] "    if (!is.null(catch)) "                                              
[24] "        catch(e)"                                                       
[25] "    else stop(e)"                                                       
[26] "}, finally = if (runFinally && !is.null(finally)) finally())"           

[[71]]
[1] "do()"

[[72]]
[1] "hybrid_chain(func(), function(value, .visible) {"               
[2] "    transform(setVisible(value, .visible), shinysession, name, "
[3] "        ...)"                                                   
[4] "})"                                                             

[[73]]
[1] "origRenderFunc(...)"

[[74]]
[1] "`output$x1`(...)"

[[75]]
[1] "..stacktraceon..(`output$x1`(...))"

[[76]]
[1] "orig(name = name, shinysession = self)"

[[77]]
[1] "func()"

[[78]]
[1] "withCallingHandlers(expr, error = doCaptureStack)"

[[79]]
[1] "globals$domain$wrapSync(expr)"

[[80]]
[1] "promises::with_promise_domain(createStackTracePromiseDomain(), "
[2] "    expr)"                                                      

[[81]]
[1] "captureStackTraces(expr)"

[[82]]
[1] "withCallingHandlers(captureStackTraces(expr), error = function(e) {"
[2] "    if (inherits(e, \"shiny.silent.error\")) "                      
[3] "        return()"                                                   
[4] "    handle <- getOption(\"shiny.error\")"                           
[5] "    if (is.function(handle)) "                                      
[6] "        handle()"                                                   
[7] "})"                                                                 

[[83]]
[1] "shinyCallingHandlers(func())"

[[84]]
[1] "force(expr)"

[[85]]
[1] "globals$domain$wrapSync(expr)"

[[86]]
[1] "promises::with_promise_domain(createVarPromiseDomain(private, "
[2] "    \"currentOutputName\", name), expr)"                       

[[87]]
[1] "private$withCurrentOutput(name, {" "    shinyCallingHandlers(func())" 
[3] "})"                               

[[88]]
[1] "force(expr)"

[[89]]
[1] "withVisible(force(expr))"

[[90]]
[1] "withCallingHandlers(expr, error = doCaptureStack)"

[[91]]
[1] "globals$domain$wrapSync(expr)"

[[92]]
[1] "promises::with_promise_domain(createStackTracePromiseDomain(), "
[2] "    expr)"                                                      

[[93]]
 [1] "captureStackTraces({"                                               
 [2] "    result <- withVisible(force(expr))"                             
 [3] "    if (promises::is.promising(result$value)) {"                    
 [4] "        p <- promise_chain(setVisible(result), ..., catch = catch, "
 [5] "            finally = finally)"                                     
 [6] "        runFinally <- FALSE"                                        
 [7] "        p"                                                          
 [8] "    }"                                                              
 [9] "    else {"                                                         
[10] "        result <- Reduce(function(v, func) {"                       
[11] "            if (\".visible\" %in% names(formals(func))) {"          
[12] "                withVisible(func(v$value, .visible = v$visible))"   
[13] "            }"                                                      
[14] "            else {"                                                 
[15] "                withVisible(func(v$value))"                         
[16] "            }"                                                      
[17] "        }, list(...), result)"                                      
[18] "        setVisible(result)"                                         
[19] "    }"                                                              
[20] "})"                                                                 

[[94]]
[1] "doTryCatch(return(expr), name, parentenv, handler)"

[[95]]
[1] "tryCatchOne(expr, names, parentenv, handlers[[1L]])"

[[96]]
[1] "tryCatchList(expr, classes, parentenv, handlers)"

[[97]]
 [1] "tryCatch({"                                                             
 [2] "    captureStackTraces({"                                               
 [3] "        result <- withVisible(force(expr))"                             
 [4] "        if (promises::is.promising(result$value)) {"                    
 [5] "            p <- promise_chain(setVisible(result), ..., catch = catch, "
 [6] "                finally = finally)"                                     
 [7] "            runFinally <- FALSE"                                        
 [8] "            p"                                                          
 [9] "        }"                                                              
[10] "        else {"                                                         
[11] "            result <- Reduce(function(v, func) {"                       
[12] "                if (\".visible\" %in% names(formals(func))) {"          
[13] "                  withVisible(func(v$value, .visible = v$visible))"     
[14] "                }"                                                      
[15] "                else {"                                                 
[16] "                  withVisible(func(v$value))"                           
[17] "                }"                                                      
[18] "            }, list(...), result)"                                      
[19] "            setVisible(result)"                                         
[20] "        }"                                                              
[21] "    })"                                                                 
[22] "}, error = function(e) {"                                               
[23] "    if (!is.null(catch)) "                                              
[24] "        catch(e)"                                                       
[25] "    else stop(e)"                                                       
[26] "}, finally = if (runFinally && !is.null(finally)) finally())"           

[[98]]
[1] "do()"

[[99]]
 [1] "hybrid_chain({"                                                               
 [2] "    private$withCurrentOutput(name, {"                                        
 [3] "        shinyCallingHandlers(func())"                                         
 [4] "    })"                                                                       
 [5] "}, catch = function(cond) {"                                                  
 [6] "    if (inherits(cond, \"shiny.custom.error\")) {"                            
 [7] "        if (isTRUE(getOption(\"show.error.messages\"))) "                     
 [8] "            printError(cond)"                                                 
 [9] "        structure(list(), class = \"try-error\", condition = cond)"           
[10] "    }"                                                                        
[11] "    else if (inherits(cond, \"shiny.output.cancel\")) {"                      
[12] "        structure(list(), class = \"cancel-output\")"                         
[13] "    }"                                                                        
[14] "    else if (inherits(cond, \"shiny.silent.error\")) {"                       
[15] "        structure(list(), class = \"try-error\", condition = cond)"           
[16] "    }"                                                                        
[17] "    else {"                                                                   
[18] "        if (isTRUE(getOption(\"show.error.messages\"))) "                     
[19] "            printError(cond)"                                                 
[20] "        if (getOption(\"shiny.sanitize.errors\", FALSE)) {"                   
[21] "            cond <- simpleError(paste(\"An error has occurred. Check your\", "
[22] "                \"logs or contact the app author for\", \"clarification.\"))" 
[23] "        }"                                                                    
[24] "        invisible(structure(list(), class = \"try-error\", condition = cond))"
[25] "    }"                                                                        
[26] "})"                                                                           

[[100]]
[1] "force(expr)"

[[101]]
[1] "withVisible(force(expr))"

[[102]]
[1] "withCallingHandlers(expr, error = doCaptureStack)"

[[103]]
[1] "globals$domain$wrapSync(expr)"

[[104]]
[1] "promises::with_promise_domain(createStackTracePromiseDomain(), "
[2] "    expr)"                                                      

[[105]]
 [1] "captureStackTraces({"                                               
 [2] "    result <- withVisible(force(expr))"                             
 [3] "    if (promises::is.promising(result$value)) {"                    
 [4] "        p <- promise_chain(setVisible(result), ..., catch = catch, "
 [5] "            finally = finally)"                                     
 [6] "        runFinally <- FALSE"                                        
 [7] "        p"                                                          
 [8] "    }"                                                              
 [9] "    else {"                                                         
[10] "        result <- Reduce(function(v, func) {"                       
[11] "            if (\".visible\" %in% names(formals(func))) {"          
[12] "                withVisible(func(v$value, .visible = v$visible))"   
[13] "            }"                                                      
[14] "            else {"                                                 
[15] "                withVisible(func(v$value))"                         
[16] "            }"                                                      
[17] "        }, list(...), result)"                                      
[18] "        setVisible(result)"                                         
[19] "    }"                                                              
[20] "})"                                                                 

[[106]]
[1] "doTryCatch(return(expr), name, parentenv, handler)"

[[107]]
[1] "tryCatchOne(expr, names, parentenv, handlers[[1L]])"

[[108]]
[1] "tryCatchList(expr, classes, parentenv, handlers)"

[[109]]
 [1] "tryCatch({"                                                             
 [2] "    captureStackTraces({"                                               
 [3] "        result <- withVisible(force(expr))"                             
 [4] "        if (promises::is.promising(result$value)) {"                    
 [5] "            p <- promise_chain(setVisible(result), ..., catch = catch, "
 [6] "                finally = finally)"                                     
 [7] "            runFinally <- FALSE"                                        
 [8] "            p"                                                          
 [9] "        }"                                                              
[10] "        else {"                                                         
[11] "            result <- Reduce(function(v, func) {"                       
[12] "                if (\".visible\" %in% names(formals(func))) {"          
[13] "                  withVisible(func(v$value, .visible = v$visible))"     
[14] "                }"                                                      
[15] "                else {"                                                 
[16] "                  withVisible(func(v$value))"                           
[17] "                }"                                                      
[18] "            }, list(...), result)"                                      
[19] "            setVisible(result)"                                         
[20] "        }"                                                              
[21] "    })"                                                                 
[22] "}, error = function(e) {"                                               
[23] "    if (!is.null(catch)) "                                              
[24] "        catch(e)"                                                       
[25] "    else stop(e)"                                                       
[26] "}, finally = if (runFinally && !is.null(finally)) finally())"           

[[110]]
[1] "do()"

[[111]]
 [1] "hybrid_chain(hybrid_chain({"                                                                
 [2] "    private$withCurrentOutput(name, {"                                                      
 [3] "        shinyCallingHandlers(func())"                                                       
 [4] "    })"                                                                                     
 [5] "}, catch = function(cond) {"                                                                
 [6] "    if (inherits(cond, \"shiny.custom.error\")) {"                                          
 [7] "        if (isTRUE(getOption(\"show.error.messages\"))) "                                   
 [8] "            printError(cond)"                                                               
 [9] "        structure(list(), class = \"try-error\", condition = cond)"                         
[10] "    }"                                                                                      
[11] "    else if (inherits(cond, \"shiny.output.cancel\")) {"                                    
[12] "        structure(list(), class = \"cancel-output\")"                                       
[13] "    }"                                                                                      
[14] "    else if (inherits(cond, \"shiny.silent.error\")) {"                                     
[15] "        structure(list(), class = \"try-error\", condition = cond)"                         
[16] "    }"                                                                                      
[17] "    else {"                                                                                 
[18] "        if (isTRUE(getOption(\"show.error.messages\"))) "                                   
[19] "            printError(cond)"                                                               
[20] "        if (getOption(\"shiny.sanitize.errors\", FALSE)) {"                                 
[21] "            cond <- simpleError(paste(\"An error has occurred. Check your\", "              
[22] "                \"logs or contact the app author for\", \"clarification.\"))"               
[23] "        }"                                                                                  
[24] "        invisible(structure(list(), class = \"try-error\", condition = cond))"              
[25] "    }"                                                                                      
[26] "}), function(value) {"                                                                      
[27] "    self$requestFlush()"                                                                    
[28] "    private$sendMessage(recalculating = list(name = name, status = \"recalculated\"))"      
[29] "    if (inherits(value, \"cancel-output\")) {"                                              
[30] "        return()"                                                                           
[31] "    }"                                                                                      
[32] "    private$invalidatedOutputErrors$remove(name)"                                           
[33] "    private$invalidatedOutputValues$remove(name)"                                           
[34] "    if (inherits(value, \"try-error\")) {"                                                  
[35] "        cond <- attr(value, \"condition\")"                                                 
[36] "        type <- setdiff(class(cond), c(\"simpleError\", \"error\", "                        
[37] "            \"condition\"))"                                                                
[38] "        private$invalidatedOutputErrors$set(name, list(message = cond$message, "            
[39] "            call = utils::capture.output(print(cond$call)), type = if (length(type)) type))"
[40] "    }"                                                                                      
[41] "    else private$invalidatedOutputValues$set(name, value)"                                  
[42] "})"                                                                                         

[[112]]
[1] "`<observer:output$x1>`(...)"

[[113]]
[1] "contextFunc()"

[[114]]
[1] "env$runWith(self, func)"

[[115]]
[1] "force(expr)"

[[116]]
[1] "globals$domain$wrapSync(expr)"

[[117]]
[1] "promises::with_promise_domain(createVarPromiseDomain(.globals, "
[2] "    \"domain\", domain), expr)"                                 

[[118]]
[1] "withReactiveDomain(.domain, {"                  
[2] "    env <- .getReactiveEnvironment()"           
[3] "    .graphEnterContext(id)"                     
[4] "    on.exit({"                                  
[5] "        .graphExitContext(id, domain = .domain)"
[6] "    }, add = TRUE)"                             
[7] "    env$runWith(self, func)"                    
[8] "})"                                             

[[119]]
[1] "globals$domain$wrapSync(expr)"

[[120]]
 [1] "promises::with_promise_domain(reactivePromiseDomain(), {"
 [2] "    withReactiveDomain(.domain, {"                       
 [3] "        env <- .getReactiveEnvironment()"                
 [4] "        .graphEnterContext(id)"                          
 [5] "        on.exit({"                                       
 [6] "            .graphExitContext(id, domain = .domain)"     
 [7] "        }, add = TRUE)"                                  
 [8] "        env$runWith(self, func)"                         
 [9] "    })"                                                  
[10] "})"                                                      

[[121]]
[1] "ctx$run(.func)"

[[122]]
[1] "run()"

[[123]]
[1] "withCallingHandlers(expr, error = doCaptureStack)"

[[124]]
[1] "globals$domain$wrapSync(expr)"

[[125]]
[1] "promises::with_promise_domain(createStackTracePromiseDomain(), "
[2] "    expr)"                                                      

[[126]]
[1] "captureStackTraces(expr)"

[[127]]
[1] "withCallingHandlers(captureStackTraces(expr), error = function(e) {"
[2] "    if (inherits(e, \"shiny.silent.error\")) "                      
[3] "        return()"                                                   
[4] "    handle <- getOption(\"shiny.error\")"                           
[5] "    if (is.function(handle)) "                                      
[6] "        handle()"                                                   
[7] "})"                                                                 

[[128]]
[1] "shinyCallingHandlers(run())"

[[129]]
[1] "force(expr)"

[[130]]
[1] "withVisible(force(expr))"

[[131]]
[1] "withCallingHandlers(expr, error = doCaptureStack)"

[[132]]
[1] "globals$domain$wrapSync(expr)"

[[133]]
[1] "promises::with_promise_domain(createStackTracePromiseDomain(), "
[2] "    expr)"                                                      

[[134]]
 [1] "captureStackTraces({"                                               
 [2] "    result <- withVisible(force(expr))"                             
 [3] "    if (promises::is.promising(result$value)) {"                    
 [4] "        p <- promise_chain(setVisible(result), ..., catch = catch, "
 [5] "            finally = finally)"                                     
 [6] "        runFinally <- FALSE"                                        
 [7] "        p"                                                          
 [8] "    }"                                                              
 [9] "    else {"                                                         
[10] "        result <- Reduce(function(v, func) {"                       
[11] "            if (\".visible\" %in% names(formals(func))) {"          
[12] "                withVisible(func(v$value, .visible = v$visible))"   
[13] "            }"                                                      
[14] "            else {"                                                 
[15] "                withVisible(func(v$value))"                         
[16] "            }"                                                      
[17] "        }, list(...), result)"                                      
[18] "        setVisible(result)"                                         
[19] "    }"                                                              
[20] "})"                                                                 

[[135]]
[1] "doTryCatch(return(expr), name, parentenv, handler)"

[[136]]
[1] "tryCatchOne(expr, names, parentenv, handlers[[1L]])"

[[137]]
[1] "tryCatchList(expr, classes, parentenv, handlers)"

[[138]]
 [1] "tryCatch({"                                                             
 [2] "    captureStackTraces({"                                               
 [3] "        result <- withVisible(force(expr))"                             
 [4] "        if (promises::is.promising(result$value)) {"                    
 [5] "            p <- promise_chain(setVisible(result), ..., catch = catch, "
 [6] "                finally = finally)"                                     
 [7] "            runFinally <- FALSE"                                        
 [8] "            p"                                                          
 [9] "        }"                                                              
[10] "        else {"                                                         
[11] "            result <- Reduce(function(v, func) {"                       
[12] "                if (\".visible\" %in% names(formals(func))) {"          
[13] "                  withVisible(func(v$value, .visible = v$visible))"     
[14] "                }"                                                      
[15] "                else {"                                                 
[16] "                  withVisible(func(v$value))"                           
[17] "                }"                                                      
[18] "            }, list(...), result)"                                      
[19] "            setVisible(result)"                                         
[20] "        }"                                                              
[21] "    })"                                                                 
[22] "}, error = function(e) {"                                               
[23] "    if (!is.null(catch)) "                                              
[24] "        catch(e)"                                                       
[25] "    else stop(e)"                                                       
[26] "}, finally = if (runFinally && !is.null(finally)) finally())"           

[[139]]
[1] "do()"

[[140]]
 [1] "hybrid_chain({"                                
 [2] "    if (!.destroyed) {"                        
 [3] "        shinyCallingHandlers(run())"           
 [4] "    }"                                         
 [5] "}, catch = function(e) {"                      
 [6] "    if (inherits(e, \"shiny.silent.error\")) {"
 [7] "        return()"                              
 [8] "    }"                                         
 [9] "    printError(e)"                             
[10] "    if (!is.null(.domain)) {"                  
[11] "        .domain$unhandledError(e)"             
[12] "    }"                                         
[13] "}, finally = .domain$decrementBusyCount)"      

[[141]]
[1] "flushCallback()"

[[142]]
[1] "FUN(X[[i]], ...)"

[[143]]
[1] "lapply(.flushCallbacks, function(flushCallback) {"
[2] "    flushCallback()"                              
[3] "})"                                               

[[144]]
[1] "ctx$executeFlushCallbacks()"

[[145]]
[1] ".getReactiveEnvironment()$flush()"

[[146]]
[1] "flushReact()"

[[147]]
[1] "serviceApp()"

[[148]]
[1] "..stacktracefloor..(serviceApp())"

[[149]]
[1] "withCallingHandlers(expr, error = doCaptureStack)"

[[150]]
[1] "globals$domain$wrapSync(expr)"

[[151]]
[1] "promises::with_promise_domain(createStackTracePromiseDomain(), "
[2] "    expr)"                                                      

[[152]]
[1] "captureStackTraces({"                      "    while (!.globals$stopped) {"          
[3] "        ..stacktracefloor..(serviceApp())" "        Sys.sleep(0.001)"                 
[5] "    }"                                     "})"                                       

[[153]]
[1] "..stacktraceoff..(captureStackTraces({"    "    while (!.globals$stopped) {"          
[3] "        ..stacktracefloor..(serviceApp())" "        Sys.sleep(0.001)"                 
[5] "    }"                                     "}))"                                      

[[154]]
[1] "runApp(x)"

[[155]]
[1] "do.call(\"runApp\", args)"

[[156]]
[1] "print.shiny.appobj(x)"

[[157]]
[1] "function (x, ...) "      "UseMethod(\"print\")(x)"



session info

─ Session info ────────────────────────────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 3.5.1 (2018-07-02)
 os       macOS  10.14.4              
 system   x86_64, darwin15.6.0        
 ui       RStudio                     
 language (EN)                        
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       America/New_York            
 date     2019-05-02                  

─ Packages ────────────────────────────────────────────────────────────────────────────────────────
 package     * version     date       lib source                             
 assertthat    0.2.1       2019-03-21 [1] CRAN (R 3.5.1)                     
 bitops        1.0-6       2013-08-17 [1] CRAN (R 3.5.0)                     
 cli           1.1.0       2019-03-19 [1] CRAN (R 3.5.1)                     
 clipr         0.5.0       2019-01-11 [1] CRAN (R 3.5.2)                     
 crayon        1.3.4       2017-09-16 [1] CRAN (R 3.5.0)                     
 curl          3.3         2019-01-10 [1] CRAN (R 3.5.2)                     
 details       0.0.51      2019-04-04 [1] local                              
 digest        0.6.18      2018-10-10 [1] CRAN (R 3.5.0)                     
 gh            1.0.1       2017-07-16 [1] CRAN (R 3.5.0)                     
 htmltools     0.3.6       2017-04-28 [1] CRAN (R 3.5.0)                     
 httpuv        1.4.5.1     2018-12-18 [1] CRAN (R 3.5.0)                     
 httr          1.4.0       2018-12-11 [1] CRAN (R 3.5.0)                     
 jsonlite      1.6         2018-12-07 [1] CRAN (R 3.5.0)                     
 later         0.8.0       2019-02-11 [1] CRAN (R 3.5.2)                     
 magrittr    * 1.5         2014-11-22 [1] CRAN (R 3.5.0)                     
 mime          0.6         2018-10-05 [1] CRAN (R 3.5.0)                     
 packrat       0.4.9-3     2018-06-01 [1] CRAN (R 3.5.0)                     
 promises      1.0.1       2018-04-13 [1] CRAN (R 3.5.0)                     
 R6            2.4.0       2019-02-14 [1] CRAN (R 3.5.2)                     
 Rcpp          1.0.1       2019-03-17 [1] CRAN (R 3.5.2)                     
 RCurl         1.95-4.11   2018-07-15 [1] CRAN (R 3.5.0)                     
 rsconnect     0.8.8       2018-03-09 [1] CRAN (R 3.5.0)                     
 rstudioapi    0.10.0-9000 2019-03-22 [1] Github (rstudio/rstudioapi@7038aee)
 rvest         0.3.2       2016-06-17 [1] CRAN (R 3.5.0)                     
 sessioninfo   1.1.1       2018-11-05 [1] CRAN (R 3.5.0)                     
 shiny       * 1.2.0       2018-11-02 [1] CRAN (R 3.5.0)                     
 shinyAce    * 0.3.2       2018-10-02 [1] CRAN (R 3.5.0)                     
 withr         2.1.2       2018-03-15 [1] CRAN (R 3.5.0)                     
 xml2          1.2.0       2018-01-24 [1] CRAN (R 3.5.0)                     
 xtable        1.8-3       2018-08-29 [1] CRAN (R 3.5.0)                     

[1] /Users/yonis/Library/R/3.5/library
[2] /Library/Frameworks/R.framework/Versions/3.5/Resources/library


Thanks, I was able to see it 👍

@yonicd did you end up developing a workaround? I'm encountering the same error while trying to call an eventReactive expression while calling a module. My eventReactive expression is also dependent on two reactive variables, and I get the error while trying to call the initial eventReactive while the other reactive variables are NULL.

In the end I think I had to be really careful on how I was using the conditional vectors in evenReactive and observeEvent. I think at the time I was developing regexSelect which also i module based and ran into similar problems as you describe. Maybe that src code and example can help you too.

Was this page helpful?
0 / 5 - 0 ratings