Warning: Error in <Anonymous>: unable to start device 'png'

I have a markdown file that runs perfectly in its current version on two different local machines. I've been able to load a previous version of this file to my shiny-server and it worked fine. I added a few code chunks and text and cloned the project from my GitHub to my shiny-server again and now I'm getting "Error: An error has occurred. Check your logs or Contact the app author for clarification."
I checked the log at /var/log/shiny-server and get this:

Blockquote
Warning in (function (filename = "Rplot%03d.png", width = 480, height = 480, :
cairo error 'invalid value (typically too big) for the size of the input (surface, pattern, etc.)'
Quitting from lines 279-322 (2021_Report.Rmd)
Warning: Error in : unable to start device 'png'
131:
129: chunk_device
128: eng_r
127: block_exec
126: call_block
125: process_group.block
122: process_file
121: knitr::knit
120:
115:
99: doc
98: renderUI
97: func
84: renderFunc
83: output$reactivedoc
3:
1: rmarkdown::run
Blockquote

I found a post that seems similar to my problem here
I checked everything mentioned there and rebuilt R from source as described but I'm still getting the same log output.

Are there other logs I can check?

capabilities() looks like this

Blockquote
capabilities()
jpeg png tiff tcltk X11 aqua
TRUE TRUE TRUE TRUE FALSE FALSE
http/ftp sockets libxml fifo cledit iconv
TRUE TRUE TRUE TRUE FALSE TRUE
NLS profmem cairo ICU long.double libcurl
TRUE TRUE TRUE TRUE TRUE TRUE
Blockquote

I'm on Amazon Linux running R-4.1.1

if it helps, I only have two Cairo libraries
cairo.x86_64
cairo-devel.x86_64

I assume these are the versions of libcairo2-dev for Amazon Linux since I can't get libcairo2-dev to install.

The other thing that is confusing me is that where the log says "quitting from lines 279-322"
I have always assumed this is the code block where the error is occurring. However, this code block used to run fine on the shiny-server. it wasn't something we added new. Also, the part that says "(function (filename = "Rplot%03d.png", width = 480, height = 480" is not text that appears within those lines or anywhere in my markdown file. I assume this is something within a function that is being called from inside something in the mentioned lines.

I'm very confused at this one. usually when I've had any issue getting a markdown file to run on our shiny-server it has been a missing package and I have easily installed the package and the application has worked. I'm not sure what to do. Any help would be much appreciated.

update, I removed the code block from where the log said the application was quitting and re-uploaded to the server and the error has moved down to the next code block, now quitting from lines 282-284
This leads me to believe that the issue is with something else in the file but I'm not sure what it is or where to look.

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

Whew - this is much belated :sweat_smile: , but just as an FYI this type of "System Dependency" issue with R is usually a better fit for the "R Admins" category :smile: There are generally more people there who can help out with this type of issue!

That said, hopefully you have worked around / found a solution by now!! Usually the best way to iterate on this type of thing is to try to create a minimally reproducible example in an "interactive" R session (rather than continuing to run the Rmd, which presumably takes a while / is complicated / etc.).

I believe this thread / comment may have a useful tidbit on this issue! If not, please open a new thread in R Admins so we can try to help get it resolved!