             # Password successfully set!
             # Set up a new login session for the user
             # (into the right context!)
-            getEffectiveUser user, (effectiveUser) ->
+            getEffectiveUser user, (err, effectiveUser) ->
+              if err?
+                console.warn "Token.find err -> #{err}"
+                return resp.send 500, error: 'Unknown error: #{err}'
+
               sessionUser =
                 real: getSessionUser user
                 effective: getSessionUser effectiveUser

  if not user
    console.warn "MYSTERIOUS: user is not in the database"
    return {}
    
  [err, plan] = Plan.getPlan user.accountLevel
  if err
    # We get here if there is no plan for the user's accountLevel.


        tool.save (err) ->
          console.warn err if err?

          Tool.findOneById tool._id, (err, tool) ->
            if err?
              console.warn err
