Skip to content

output file name conflict when two formats targets same extension (like html and revealjs) #4583

Open

Description

@royfrancis

Bug description

When defining both html and revealjs formats in the config (_quarto.yml), if format is not defined in individual qmd files, it gives this error:

ERROR: NotFound: No such file or directory (os error 2), rename '/home/user/Desktop/test/report.html' -> '/home/user/Desktop/test/_site/report.html'

To reproduce, create three files:

_quarto.yml

project:
  type: website

website:
  title: "Test"

format:
  html:
    theme: "flatly"
  revealjs:
    theme: "beige"

presentation.qmd

---
title: "Presentation"
format: revealjs
---

## Slide 1

This is a presentation

## Slide 2

More contents here

report.qmd

---
title: "Report"
---

## Heading 1

This is a report

Then run quarto render. Adding format: html to report.qmd fixes this issue.

It took me a while to troubleshoot as the error message was not helpful.

🢒  quarto --version
1.2.1

🢒  lsb_release -a
No LSB modules are available.
Distributor ID:	Zorin
Description:	Zorin OS 16.2
Release:	16
Codename:	focal

Checklist

  • Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
  • Please format your issue so it is easier for us to read the bug report.
  • Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
  • Please document the operating system you're running. If on Linux, please provide the specific distribution.

Activity

  1. added
    bug
    on Mar 1, 2023
  2. cscheid commented on Mar 1, 2023

    @cscheid
    Member

    It would be ideal for quarto to issue a warning in this sort of scenario. But what's happening here is that both of your html and revealjs formats are rendering to the same output file. When you write in your _quarto.yml

    format:
      html:
        theme: "flatly"
      revealjs:
        theme: "beige"
    

    you're effectively telling quarto: "render these two formats when I don't specify otherwise". So quarto will attempt to render a revealjs presentation and a webpage for every .qmd file. This confuses quarto, because they both generate .html files.

    Things work when you specify a single format (like format: html or format: revealjs) because we take those to mean "render only this specific format".

    As a result, when you're using this particular style in _quarto.yml, you really do need to specify a particular format at every .qmd file. We'd like to do better here and warn that multiple outputs are being generated (and so quarto will step on its own toes along the way), but it's a generally hard problem because we don't control all possible filenames.

    In the end, I agree this is a bug, but it'll be very hard for us to fix it in a short to medium timeframe.

  3. added this to the Future milestone on Mar 1, 2023
  4. added a commit that references this issue on Mar 9, 2023
  5. chaz-clark commented on Sep 26, 2023

    @chaz-clark
  6. mcanouil commented on Sep 26, 2023

    @mcanouil
  7. changed the title [-]ERROR: NotFound: No such file or directory (os error 2), rename[/-] [+]output file name conflict when two formats targets same extension (like html and revealjs)[/+] on Sep 27, 2023
  8. added
    files
    on Jul 14, 2025
  9. mcanouil commented on Jul 14, 2025

    @mcanouil
    Collaborator

    output-file can be set per format to avoid the issue:

    format:
      html: default
      revealjs:
        output-file: my-revealjs
  10. petrelharp commented on Jan 5, 2026

    @petrelharp

    The original issue here has two formats in _quarto.yml; I'd like to point out the same bug manifesting in a different use case. Here's a MWE that fails to render:

    ---
    title: Sample Page
    format: 
      html: default
      revealjs: default
    ---
    
    # Hello world
    
    hi there
    

    and (as test.qmd) gives the very non-informative error

    ERROR: NotFound: No such file or directory (os error 2): rename '/home/peter/teaching/ds435/test_website/test.html' -> '/home/peter/teaching/ds435/test_website/docs/test.html'
    

    As other have said (and is indeed in the documentation, a workaround is to specify the output file, for instance:

      revealjs:
          output-file: test.slides.html
    

    The fundamental problem is not using unique file extensions for each format; it might have been nice to follow jupyter's nbconvert in making revealjs output use .slides.html.

    A possible solution that doesn't break backwards compatibility would be to have a top-level configuration option that lets you set the suffix so that they don't clobber each other; for instance in _quarto.yml

    revealjs:
        extension: slides.html
    
  11. petrelharp commented on Jan 6, 2026

    @petrelharp

    Why, yes, that is what I mean!

    So, here's a solution: add

    format:
      revealjs:
        output-ext: slides.html
    

    to either the file itself or to _quarto.yml (but if the latter, note that all files without format explicitly specified will then be rendered to slides). This seems like better advice than specifying output-file because it's a line that can be copy-pasted between files, or specified globally, without requiring file-specific changes.

    It seems to me that (a) a more informative error, and (b) providing the advice to change output-ext in the documentation and maybe the error message itself would close this issue (and the many quasi-duplicates of it).

  12. mcanouil commented on Jan 6, 2026

    @mcanouil
    Collaborator

    Unfortunately, in complex projects such as book/website, changing the extension tends to break links last time I checked (there is probably an issue about it).

    Edit:

  13. petrelharp commented on Jan 6, 2026

    @petrelharp

    Good to know, thanks. However, that's also a bug, so if that is fixed then this will work...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugfiles

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions