Lua load error on startup causes rare errors

Apologies, this is difficult to reproduce, it only occurs sometimes, usually immediately after login.

I have the following function render some of my index page:

function inbox.notes()
  local res = template.each(query[[
    from index.tag "page"
    where string.startsWith(name, "Inbox/")
  ]], template.new[==[
**[[${name}|${string.sub(name,7)}]]** - ${string.split(space.readPage(name),"\n")[1]}
]==])
  if some(res) then
    return [==[# Inbox notes
]==] .. string.trimEnd(res)
  else
    return ""
  end
end

This usually works fine. However, sometimes, I get this error instead:

**Lua error:** Error evaluating "string.split(space.readPage(name),"\n")[1]": Not found (Origin: [[Library/Std/APIs/Template@912]])

Nothing relevant seems to pop up in the logs when this happens. I’m not even sure what is “Not found”. Reloading the page (F5 on desktop browser) seems to work around it.