     _.extend options, pageTitles.PageTitles[options.page]
     options.subnav ?= 'subnav'
     fs.readFile "client/template/#{options.subnav}.eco", (err, subnavTemplate) ->
+      if err?
+        console.warn "Template #{options.page} not found when rendering server side"
+        return resp.send 500, {error: "Template not found: #{err}"}
+
       fs.readFile "client/template/nav.eco", (err, navTemplate) ->
+        if err?
+          console.warn "Template #{options.page} not found when rendering server side"
+          return resp.send 500, {error: "Template not found: #{err}"}
+
         getSessionUsersFromDB req.user, (usersObj) ->
           resp.render 'index',
               title: options.title or 'ScraperWiki'

          view = _.findWhere dataset.views, box: box.name
          view.state = 'installed'
          dataset.save (err) ->
            callback null, view

switchUser = (req, resp) ->


getToken = (req, resp) ->
  Token.find req.params.token, (err, token) ->
    if err?
      return resp.send 500, { error: "Error #{err}" }

    if token?.shortName
      return resp.send 200, { token: token.token, shortName: token.shortName }
    else
