carpentries / sandpaper

User Interface for The Carpentries Workbench
https://carpentries.github.io/sandpaper
Other
41 stars 24 forks source link

lesson.lua throwing "attempt to index a nil value" error #581

Closed froggleston closed 3 months ago

froggleston commented 5 months ago

As reported by @dmgatti in the Carpentries slack, when building a lesson with empty callouts, specifically the keypoints div ...

...

::::: keypoints

:::::

...

... sandpaper::build_lesson() will fail with the following error:

> sandpaper::build_lesson()
...
sandpaper\rmarkdown\lua\lesson.lua:151: attempt to index a nil value (local 'header')

> .Last.error
<callr_error/rlib_error_3_0/rlib_error/error>
Error: 
! in callr subprocess.
Caused by error: 
! pandoc document conversion failed with error 83
ℹ See `$stderr` for standard error.
---
Backtrace:
1. sandpaper::build_lesson()
2. sandpaper:::build_site(path = path, quiet = quiet, preview = preview, override = override, …
3. sandpaper::build_episode_html(path_md = abs_md[i], path_src = abs_src[i], …
4. sandpaper:::render_html(path_md, quiet = quiet)
5. callr::r(function(d, v, ...) { …
6. callr:::get_result(output = out, options)
7. callr:::throw(callr_remote_error(remerr, output), parent = fix_msg(remerr[[3]]))
---
Subprocess backtrace:
1. rmarkdown::pandoc_convert(...)
2. rmarkdown:::stop2("pandoc document conversion failed with error ", result)
3. base::stop(..., call. = FALSE)
4. | base::.handleSimpleError(function (e) …
5. global h(simpleError(msg, call))
froggleston commented 5 months ago

There are two potential fixes:

froggleston commented 5 months ago

I went for option 2 for now, so temporarily fixed in b8c9a94