Repository navigation
Description
Bug description
Hi all,
I've been using quarto successfully for some time now. On my main machine, I can't seem to perform any quarto render or quarto preview commands. Using VSCode's quarto plugin produces the same error. I also have quarto installed inside of a docker container which produces an error, though a different one.
Do not know why a previously functioning quarto is no longer working (details below)
Steps to reproduce
My directory consists of a Git repository with several submodules. The parent / root directory contains a _quarto.yml file with the following contents
project:
type: website
output-dir: ./notebook/_site
render:
- "*.qmd"
- "*.md"
- "*.ipynb"
preview:
port: 3333
browser: true
watch-inputs: true
timeout: 300
bibliography:
- ./notebook/references.bib
csl: ./notebook/ama.csl
citation: false
google-scholar: true
website:
title: "redacted Project"
navbar:
left:
- href: index.qmd
text: Home
- href: https://github.com/redacted
text: GitHub
- href: notebook/external/redacted
search: true
open-graph: true
sidebar:
style: "docked"
contents: auto
repo-url: https://github.com/redacted
repo-actions: [issue, edit]
reader-mode: true
repo-url: https://github.com/redacted
repo-actions: [issue, edit]
page-footer: "redacted"
format:
html:
theme:
light: flatly
dark: darkly
toc: true
lang: en-US
email-obfuscation: javascript
code-fold: true
code-line-numbers: true
code-overflow: wrap
grid:
sidebar-width: 350px
default-image-extension: svg
# pdf:
# # pdf-engine: latexmk
# documentclass: scrartcl
# toc: true
# code-fold: true
# papersize: letter
# # toc-depth: 2
# # lof: true
# # lot: true
# margin-left: 30mm
# margin-right: 30mm
# highlight-style: github
# colorlinks: true
# default-image-extension: png
execute:
freeze: auto
cache: true
error: trueI use quarto to build a static website, which is rendered in ./notebook/_site.
Command
quarto renderExpected behavior
Begin rendering the website by going into the subdirectories and rendering .ipynb, .qmd, etc.
Output to notebook/_site/
Actual behavior
Debian
(scRNAseq) pranav@singulab prrx1 (main) : quarto render
ERROR: SyntaxError: Unexpected end of JSON input
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at Object.target (file:///home/pranav/opt/quarto-1.3.433/bin/quarto.js:55201:27)
at fileExecutionEngineAndTarget (file:///home/pranav/opt/quarto-1.3.433/bin/quarto.js:58033:33)
at renderContexts (file:///home/pranav/opt/quarto-1.3.433/bin/quarto.js:82635:40)
at Object.renderFormats (file:///home/pranav/opt/quarto-1.3.433/bin/quarto.js:82688:32)
at inputTargetIndex (file:///home/pranav/opt/quarto-1.3.433/bin/quarto.js:83504:35)
at entryFromHref (file:///home/pranav/opt/quarto-1.3.433/bin/quarto.js:92762:25)
at nodesToEntries (file:///home/pranav/opt/quarto-1.3.433/bin/quarto.js:92733:36)
at async nodesToEntries (file:///home/pranav/opt/quarto-1.3.433/bin/quarto.js:92729:35)
at async nodesToEntries (file:///home/pranav/opt/quarto-1.3.433/bin/quarto.js:92729:35)I also get a similar same output when trying quarto preview
(scRNAseq) pranav@singulab prrx1 (main) : quarto preview
Preparing to preview
ERROR: SyntaxError: Unexpected end of JSON input
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at Object.target (file:///home/pranav/opt/quarto-1.3.433/bin/quarto.js:55201:27)
at fileExecutionEngineAndTarget (file:///home/pranav/opt/quarto-1.3.433/bin/quarto.js:58033:33)
at renderContexts (file:///home/pranav/opt/quarto-1.3.433/bin/quarto.js:82635:40)
at Object.renderFormats (file:///home/pranav/opt/quarto-1.3.433/bin/quarto.js:82688:32)
at inputTargetIndex (file:///home/pranav/opt/quarto-1.3.433/bin/quarto.js:83504:35)
at resolveInputTarget (file:///home/pranav/opt/quarto-1.3.433/bin/quarto.js:83583:25)
at serveFiles (file:///home/pranav/opt/quarto-1.3.433/bin/quarto.js:103550:30)
at async serveProject (file:///home/pranav/opt/quarto-1.3.433/bin/quarto.js:103188:30)
at async Command.fn (file:///home/pranav/opt/quarto-1.3.433/bin/quarto.js:103749:13)Docker
root@f00ca38999ac:/home/rstudio/work# quarto render
ERROR: Include directive needs filename as a parameterVSCode
Produces the same error as listed under 'Debian'.
Your environment
OS: Debian 12
IDE: VSCode 1.80.2
Quarto: 1.3.433
Quarto check output
As a sanity check, I even uninstalled and reinstalled quarto
(scRNAseq) pranav@singulab prrx1 (main) : quarto check
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.1.1: OK
Dart Sass version 1.55.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.3.433
Path: /home/pranav/opt/quarto-1.3.433/bin
[✓] Checking basic markdown render....OK
[✓] Checking Python 3 installation....OK
Version: 3.10.12 (Conda)
Path: /home/pranav/mambaforge/envs/scRNAseq/bin/python
Jupyter: 5.3.1
Kernels: python3
[✓] Checking Jupyter engine render....OK
[✓] Checking R installation...........OK
Version: 4.3.1
Path: /home/pranav/mambaforge/envs/scRNAseq/lib/R
LibPaths:
- /home/pranav/mambaforge/envs/scRNAseq/lib/R/library
knitr: (None)
rmarkdown: (None)
The rmarkdown package is not available in this R installation.
Install with install.packages("rmarkdown")
Activity
dragonstyle commentedon Aug 1, 2023
Quarto keeps an index of all project inputs in the
.quartohidden directory, which for some reason we appear to be having trouble reading.One thing that is confusing me - in the docker section, there is an error indicating that an include has been specified without a file name. Can you clarify what this error is? I'm wondering whether you perhaps have an error in an include shortcode and that has somehow caused a problem for us when attempting to resolve an input using that index...
pranavmishra90 commentedon Aug 1, 2023
Thanks for the quick reply. I was able to find the source of the error with your comment. I'll document it below, along with a possible feature recommendation / enhancement.
TLDR: Source of error was an empty jupyter notebook
There was a jupyter notebook which had a single empty code cell inside. After deleting this file, the
quarto previewandquarto rendercommands executed as intended.Steps to reproduce
Investigating the
.quarto/directoryI tried several variations on:
.quarto/chmod 777wondering if there was a write permission issueNone of these fixed the issue.
Testing on a entirely new directory / project
Created a new directory at
~/testing, made a simpleindex.qmdfile, and tried aquarto render index.qmd. It worked, showing that quarto itself was not at faultTrying to see which file in my project was causing the error
Starting over with an empty
.quarto/, I reranquarto render, which produced the JSON error. I then tried to determine which file was the offending one by looking at "what was the most recently modified thing inside of the.quarto/directory:The output was
2023-08-01 07:26:33.749877086 -0500 ./idx/code/python/scvi/phase_2/03 - cell_annotation.ipynb.json, which I incorrectly assumed was the offending file. This should be considered as the "last correctly processed file". (Foreshadowing) The next file in the directory is the offending one.Specifically prevented the rendering of that notebook with:
This did not work, but blocking the render to the all jupyter notebooks, then specifically just the parent directory did. I had recently created copies of multiple notebooks while testing something, so the titles were all the same, but filenames were different. Thinking this may lead to some sort of error when building the sidebar (though it hasn't before with copies of files), I changed all of the yaml headers.
While going file by file, that's when I reached the empty file. I deleted it and quarto began functioning as intended.
Recommendation
To end users:
The top result is the most recently modified file. Find the file that comes next in the directory. This is the cause of the problem
To quarto devs
As an enhancement, can quarto possibly provide the file it was working on rendering which produced the error. This would give an end user a place to start debugging. The JSON error with javascript lines does not provide this level of specificity.
I actually did not know that there is a rapid JSON conversion of the files until digging into this issue. I assumed that it went file by file, as shown by the printed output (STOUT)
If there was a way to show an error message at the initial
quarto preview/quarto renderstage, it could be helpfulcscheid commentedon Aug 11, 2023
Thanks for the report. We should definitely improve this error.
cscheid commentedon Nov 15, 2023
Pushing this to 1.5 when we'll have better information about which file is being processed by what part of the code.
fredguth commentedon Feb 1, 2024
I just would like to add that I am also experiencing the same problem. I was following the instructions of the new Manuscript guide when it happened. I "solved it" by restoring the repo to the original.