Skip to content

Quarto R chunks do not display a consistent order when printing warnings #13245

@ColinFay

Description

@ColinFay

Bug description

The standard behaviour for R function is to print the warning after everything in the function is computed:

hello_then_warn <- function(){
  warning("Warning")
  print("Hello world")
}
hello_then_warn()
Image

If I put this function in a Qmd and render it, the warning is before the "Hello world"

Image

If I use the option chunk_output_type: console in the notebook, the order is correct

Image

If I use the option chunk_output_type: inline, the order is different

Image

Steps to reproduce

Create a qmd with the following function in an R chunk

hello_then_warn <- function(){
  warning("Warning")
  print("Hello world")
}
hello_then_warn()

Actual behavior

The warning message is before the print

Expected behavior

The warning message is after the print

Your environment

  • RSTUDIO server 2025.05.1 Build 513

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestknitrtriaged-toIssues that were not self-assigned, signals that an issue was assigned to someone.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions