Same Quarto file OK in one directory but errors in another

I have a test folder where I've worked out the changes to individual files that I need to make to change from a distil site to quarto. There are 6 quarto files in the test folder and a couple dozen in the target (was distil) folder. When I knit a file that runs fine in the test folder in the target folder, quarto renders the page but throws this error message:

ERROR: TypeError: Found non-callable @@iterator

Google doesn't turn up anything that I recognize as relevant (example). Can anybody suggest an approach (or a solution)?

The YAML, styles, and theme files are identical on both sides.

I'm also finding problems when quarto tries to render a leaflet map. :frowning:

Disappointing.

Continuing my exploration (and befuddlement) about Quarto.

I added a page to my quarto test site project that runs several code chunks (some data munging, a couple of ggplots, a couple gt tables, etc.) Now I get an error that I can't make sense of:

ERROR: unexpected character 'l' at line 1 col 1
Error running filter /Applications/quarto/share/filters/layout/layout.lua:
/Applications/quarto/share/pandoc/datadir/_json.lua:167: bad 'for' initial value (number expected, got nil)
stack traceback:
	/Applications/quarto/share/pandoc/datadir/_json.lua:381: in function '_json.decode'
	/Applications/quarto/share/filters/layout/layout.lua:3598: in function 'parseLayoutWidths'
	/Applications/quarto/share/filters/layout/layout.lua:4231: in function 'layoutCells'
	/Applications/quarto/share/filters/layout/layout.lua:4055: in function </Applications/quarto/share/filters/layout/layout.lua:4048>

Whether the extra page (which runs fine as an .Rmd file under distill) is listed in the _quarto.yml or not, just it's presence in the project directory causes other pages to fail in the rendering process. It seems that quarto aims to render all the pages in the project, even though I'm trying to render only one page.

I found the culprit. A leftover chunk option from {distill} makes Quarto crash. This snippet shows code that will make Quarto fail and produces the error messages shown above:

---
title: "A small example"
page-layout: article
---

```{r setup, layout="l-body-outset"}
mtcars[,1:3] |> head()