Error when visiting tag pages #3

ndarilek opened this Issue Jan 18, 2014 · 4 comments


None yet
4 participants

Hi, new Docpad user here, so please excuse me if I fail to provide relevant information.

Using the latest versions of Docpad and your tags plugin as of this morning. I have a setup like so:

  extension: ".html.jade"
  injectDocumentHelper: (document) ->
      layout: 'default'
      data: "!=partial('tag')"

I get correctly-formatted tag pages in out/tags/whatever.html.

I'm using cleanurls. If I hit http://localhost:9778/tags/sometag, I get the following error:

TypeError: Cannot read property 'size' of null
at DocPad.serveDocument (/home/nolan/Projects/
at DocPad.serveDocument (/home/nolan/Projects/
at /home/nolan/Projects/
at DocPad.getFileByRoute (/home/nolan/Projects/
at DocPad.serverMiddlewareRouter (/home/nolan/Projects/
at Object.handle (/home/nolan/Projects/
at next (/home/nolan/Projects/
at pass (/home/nolan/Projects/
at Router._dispatch (/home/nolan/Projects/
at Object.router (/home/nolan/Projects/
at next (/home/nolan/Projects/
at DocPad.serverMiddlewareHeader (/home/nolan/Projects/
at Object.handle (/home/nolan/Projects/
at next (/home/nolan/Projects/
at Object.handle (/home/nolan/Projects/
at next (/home/nolan/Projects/
at Object.methodOverride as handle
at next (/home/nolan/Projects/
at Object.json as handle
at next (/home/nolan/Projects/
at Object.urlencoded as handle
at next (/home/nolan/Projects/
at Object.expressInit as handle
at next (/home/nolan/Projects/
at Object.query as handle
at next (/home/nolan/Projects/
at (/home/nolan/Projects/
at app (/home/nolan/Projects/
at EventEmitter.emit (events.js:98:17)
at request (/home/nolan/Projects/
at Server.EventEmitter.emit (events.js:98:17)
at HTTPParser.parser.onIncoming (http.js:2108:12)
at HTTPParser.parserOnHeadersComplete as onHeadersComplete
at Socket.socket.ondata (http.js:1966:22)
at TCP.onread (net.js:525:27)

I tried hitting tags/whatever.html since I'm using cleanurls and I wondered if that might be an issue, but no luck. I only see this with tag pages; others on my site seem to generate and render fine.

Thoughts? Please let me know if I can provide more details. I'm new enough at Docpad that I don't quite understand what interacts with what else and how. Thanks!

+1, I have same error

Yes, I have error too

And maybe it not linked, but tags generated only if you run docpad for the first time. When running watch, tags not found.

I'm having this problem too.

This seems to be because of the ETag generation that happens around docpad.js:4098. I'm not sure why the document.getStat() call is failing, because the document certainly exists, and seems to have correct paths when I dump it at that stage.

If I protect the ETag generation with a check on stat && mtime (instead of mtime alone), then at least the error doesn't happen.

@balupton balupton added a commit to docpad/docpad that referenced this issue Jan 27, 2014

@balupton balupton Merge pull request #787 from timaschew/patch-1
add null check for stat docpad/docpad-plugin-tags#3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment