Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"ERROR: RangeError: Invalid string length" if _quarto.yml is too large #10504

Closed
nickvigilante opened this issue Aug 12, 2024 · 3 comments · Fixed by #10508
Closed

"ERROR: RangeError: Invalid string length" if _quarto.yml is too large #10504

nickvigilante opened this issue Aug 12, 2024 · 3 comments · Fixed by #10508
Labels
bug Something isn't working deno Issues related to deno websites Issues creating websites

Comments

@nickvigilante
Copy link

Bug description

In our Quarto site, we wrote a large number of pages and included those pages in our sidebar. After some time, we noticed an error if we included too many pages in the sidebar:

ERROR: RangeError: Invalid string length

Stack trace:
    at JSON.stringify (<anonymous>)
    at buildJsYamlAnnotation (file:///Applications/quarto/bin/quarto.js:18213:10)
    at readAnnotatedYamlFromMappedString (file:///Applications/quarto/bin/quarto.js:18096:16)
    at readAndValidateYamlFromMappedString (file:///Applications/quarto/bin/quarto.js:18454:30)
    at readAndValidateYamlFromFile (file:///Applications/quarto/bin/quarto.js:20495:50)
    at file:///Applications/quarto/bin/quarto.js:20533:36
    at Array.map (<anonymous>)
    at includedMetadata (file:///Applications/quarto/bin/quarto.js:20530:55)
    at file:///Applications/quarto/bin/quarto.js:73754:40
    at async projectContext (file:///Applications/quarto/bin/quarto.js:73546:26)

If I delete enough text from random places, remove unnecessary keys, and delete all comments, it seems to have worked around the issue for now, but I'm positive this issue will occur again, as we're regularly adding more pages to our site.

The sample app I've attached below is a 2000-page site with a matching sidebar to illustrate the behavior.

Steps to reproduce

  1. Clone https://github.com/nickvigilante/invalid-string-length-issue
  2. quarto preview

Expected behavior

Quarto builds the site normally.

Actual behavior

An error is thrown.

Your environment

  • OS: macOS Sonoma 14.6.1

Quarto check output

Quarto 1.5.56
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.2.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.41.0: OK
      Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.5.56
      Path: /Applications/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: (not installed)
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Tex:  (not detected)

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.10.14 (Conda)
      Path: /Users/nickv/miniforge3/bin/python
      Jupyter: 5.7.2
      Kernels: ir, python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.4.1
      Path: /opt/homebrew/Cellar/r/4.4.1/lib/R
      LibPaths:
        - /opt/homebrew/lib/R/4.4/site-library
        - /opt/homebrew/Cellar/r/4.4.1/lib/R/library
      knitr: 1.47
      rmarkdown: 2.27

[✓] Checking Knitr engine render......OK
@nickvigilante nickvigilante added the bug Something isn't working label Aug 12, 2024
@mcanouil
Copy link
Collaborator

Thanks for the report and the reproducible example.
I can reproduce with quarto render.

@mcanouil mcanouil added the websites Issues creating websites label Aug 13, 2024
@cscheid
Copy link
Collaborator

cscheid commented Aug 13, 2024

Huh. I don't know that we'll be able to fix this, because the problem is apparently happening inside JSON.stringify, a function from Deno's standard library.

@cscheid
Copy link
Collaborator

cscheid commented Aug 13, 2024

It seems to be an instance of this: nodejs/node-v0.x-archive#14170

That call to stringify is not truly necessary - it's there to prevent an infinite loop that might arise from circular structures. But we really shouldn't be failing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working deno Issues related to deno websites Issues creating websites
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants