### Bug description

## To Reproduce The Error

### Step 1: Clone the minimal example

```bash
git clone https://github.com/hamelsmu/tquarto.git && cd tquarto
```

### Step 2: Run quarto through a subprocess

(You should look at the contents of this file, it is just two lines of code)

```bash
python run_quarto.py
```

### Step 3: Navigate to the /test.html page (which is also on the navbar)

The Error we get:

```
assertion failed [block != nullptr]: BasicBlock requested for unrecognized address
(BuilderBase.h:550 block_for_offset)
/usr/local/bin/quarto: line 145:  9849 Trace/BPT trap: 5       "${QUARTO_DENO}" ${QUARTO_ACTION} ${QUARTO_DENO_OPTIONS} ${QUARTO_DENO_EXTRA_OPTIONS} "${QUARTO_IMPORT_ARGMAP}" "${QUARTO_TARGET}" "$@"
```

If you don't get an error the first time, you can try this multiple times and eventually get an error.  I've also reproduced this on other machines.

## Info about my system:

- OS: MacOS Monterey 12.5.1, Apple M1 Pro
- Quarto Version `1.2.92`
- Python 3.9.12

##  Observations

- Running `quarto docs` or `quarto preview` does **not** produce the error
- The error only occurs when I run quarto through a subprocess by running `python run_quarto.py`
- The error mostly occurs when I navigate to the page generated by the notebook (i.e. `test.html`), but sometimes also occurs on server start as I think sometimes it tries to open that page directly
- I was able to repro this issue on a M1 Mac server which is a fresh/brand new environment, and other people have been able [to repro as well](https://github.com/fastai/nbdev/issues/1040). 

Could this be related to https://github.com/quarto-dev/quarto-cli/issues/2296 ? 

cc: @jjallaire 


### Checklist

- [X] 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.
- [X] Please [format your issue](https://quarto.org/bug-reports.html#formatting-make-githubs-markdown-work-for-us) so it is easier for us to read the bug report.
- [X] Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
- [X] Please document the operating system you're running. If on Linux, please provide the specific distribution.
cscheid
2022-09-13T00:15:41Z
hamelsmu
bug
closed
Quarto Preview Fails when run from `subprocess.run` in python on Apple Silicon / M1
https://github.com/quarto-dev/quarto-cli/issues/2420