9

After installing the new version of shiny (1.4.0) package, I face a strange error message

> Warning: Error in writeImpl: Text to be written must be a length-one
> character vector   [No stack trace available]

I do not really understand what has been changed? And how to fix this issue?

Any idea would be highly appreciated!

The Trace looks as follows:

13: execCallbacks(timeoutSecs, all, loop$id)
12: force(expr)
11: with_loop(loop, invisible(execCallbacks(timeoutSecs, all, loop$id)))
10: run_now(timeoutMs/1000, all = FALSE)
9: service(timeout)
8: serviceApp()
7: ..stacktracefloor..(serviceApp())
6: withCallingHandlers(expr, error = doCaptureStack)
5: domain$wrapSync(expr)
4: promises::with_promise_domain(createStackTracePromiseDomain(), 
       expr)
3: captureStackTraces({
       while (!.globals$stopped) {
           ..stacktracefloor..(serviceApp())
       }
   })
2: ..stacktraceoff..(captureStackTraces({
       while (!.globals$stopped) {
           ..stacktracefloor..(serviceApp())
       }
   }))
1: runApp("Projects/Bomboleo")

No traceback available 
And_R
  • 1,647
  • 3
  • 18
  • 32
  • 7
    This error occurs in `htmltools::WSTextWriter` (see [here](https://rdrr.io/cran/htmltools/src/R/utils.R) and CTRL+F to look for "writeImpl"). This function is in charge of properly writing text to your display when you display a raw text in any UI function. It raises the mentioned error when the `writeImpl()` function receives more than one character string (aka element of a `character()` vector). To correct this, make sure you never provide two character strings to a Shiny UI function asking for only one character argument. – Elie Ker Arno Oct 29 '19 at 16:39
  • 1
    Thanks. Cf [github.com/rstudio/htmltools #147: WSTextWriter does not handle multiple character values](https://github.com/rstudio/htmltools/issues/147). I did `tags$tr(HTML(paste0(myvar,collapse="")))` – phili_b Jan 17 '20 at 10:03
  • I had a similar issue. Turned out that I had a standard Shiny `textInput` control with more than one string given as the default (`value`) argument. – knowah Mar 04 '20 at 15:50
  • Similar issue with : `tags$div(class=c("a","b"),"a")`. Should be `tags$div(class="a b","a")` – fxi Dec 23 '20 at 16:36

3 Answers3

2

One line in my codes is, c("text/csv","text/comma-separated-values,text/plain",".csv") It creates the same problem, because it passes the three text arguments.
Thus, I just rewrite it looking like c(".csv"), now it passes one text only! No more error now in my Shiny App!!

This error happens on UI part only.

1

If you use dataTable to display tables in your shiny app, like I have, I found that some of the stylistic qualifiers clash with the output causing this error. For myself, once I deleted 'overflow-x: scroll' from the style options of the dataTable, everything worked and rendered properly in the app.

wetcoaster
  • 367
  • 3
  • 15
0

I had the same problem, but after playing around with removing the spaces behind some of the commas it finally worked for me! So my advise is to restructure your code, R probably doesn't recognize it due to some spaces at the end of a line of code

Mudimans
  • 17
  • 1