Run All not working in R Markdown

Hi,

I'm experiencing an issue where running all chunks in an R Markdown file suddenly stopped working. It changed today while I was coding, and is now consistently producing an error.

Setup:

  • RStudio 2026.05.0+218
  • Quarto 1.9.37
  • OS: macOS

Problem 1: Cmd+A + Cmd+Enter breaks at header

When I select all and run this is shown to me in the console:

> ---
+ title: "Title"
Error in -title : invalid argument to unary operator

This used to work without any errors or warnings.

Problem 2: Run All and Run All Chunks Above/Below do nothing

All Run All options in the menu produce no output and no error, they simply do nothing. Run Current Chunk works fine.

What I've tried (and didnt work):

  • Restarting R session/Terminating it
  • Restarting RStudio
  • Reinstalling RStudio
  • Testing with a new .Rmd file with only the default header
  • Testing on a second computer with an older RStudio version

What could cause Run All Chunks to stop working entirely? How can I fix this? This happened on two different machines, so it doesn't seem to be installation-specific.

Thanks in advance.

1 Like

Can you post a minimal Quarto file exhibiting the problem?

Thanks for the reply! To clarify: I'm using R Markdown (.Rmd), not Quarto (.qmd), I only mentioned Quarto because it shows up in my RStudio version info.

The problem occurs even with a new .Rmd file with the default template when creating a new R Markdown document:

---
title: "test"
author: "Elian"
date: "`r Sys.Date()`"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

```{r}
1 + 1
```

With this file:

  • Cmd+A + Cmd+Enter produces the unary operator error on the header and stops
  • Run All Chunks (via menu or shortcut) does nothing at all
  • Run Current Chunk works fine

This happens on two different machines with different RStudio versions, and also with a fresh R session.

Is this what you wanted?

1 Like

Update: I found the root cause of the "Run All Chunks does nothing" issue. An unclosed code fence (```) in one of my .Rmd files was somehow blocking chunk execution across other documents as well. Closing the fence it resolved the Run All Chunks problem.

However, the issue with Cmd+A + Cmd+Enter executing the header as R code still persists. Is this expected behavior? It did not behave this way previously.

1 Like

I can't speak to previous behavior, but Cmd+A+Cmd+Enter (Cmd -> Ctrl here) does the same thing for me that you reported, and it seems reasonable to me. Cmd+A highlights the entire file, including things that are not R code. Cmd+Enter expects to be running R code, not knitting a document or running just selected chunks of the highlighted text. I always use one of the "run chunks" commands when seeking to execute code in an Rmd file.

1 Like

This topic was automatically closed 7 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.