### Bug description

With the following setup,

`index.qmd`:
```
Example Website
```

`create.sh`:
```
#!/bin/sh
mkdir -p example
echo "hello" > example/hello.qmd
```

`_quarto.yml`:
```
project:
  type: website
  pre-render: sh create.sh

website:
  title: Example Website
  sidebar:
    title: "Example Sidebar"
    contents:
      - index.qmd
      - auto: "example"
```

I see the following error when running `QUARTO_PRINT_STACK=true quarto render`,

```
ERROR: TypeError: Cannot convert undefined or null to object

TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at findIndexFile (file:///Applications/quarto/bin/quarto.js:91210:19)
    at nodesToEntries (file:///Applications/quarto/bin/quarto.js:91187:36)
    at sidebarItemsFromAuto (file:///Applications/quarto/bin/quarto.js:91115:31)
    at expandAutoSidebarItems (file:///Applications/quarto/bin/quarto.js:91037:37)
    at resolveSidebarItems (file:///Applications/quarto/bin/quarto.js:91660:32)
    at sidebarEjsData (file:///Applications/quarto/bin/quarto.js:91651:11)
    at sidebarsEjsData (file:///Applications/quarto/bin/quarto.js:91635:32)
    at initWebsiteNavigation (file:///Applications/quarto/bin/quarto.js:91273:37)
    at Object.preRender (file:///Applications/quarto/bin/quarto.js:95841:15)
```

Re-running the command then works OK, presumably because the `example` directory and `hello.qmd` file now exist before running `quarto render`. I would expect that Quarto would be able to find and render new files created by the `pre-render` script.

I note that when not using `auto` with a subdirectory there is no error thrown, however the new file is simply missing from the sidebar.

## Extra Info
 * macOS Ventura (13.0.1, arm64)
 * quarto-cli v1.2.280 & v1.3.56


### 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.
- [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.
- [ ] 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.
dragonstyle
2022-12-22T11:19:41Z
georgestagg
bug project-scripts
v1.4
open
Website sidebar auto generation fails for new files created by pre-render script
https://github.com/quarto-dev/quarto-cli/issues/3737