{"action":"created","issue":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/4847","repository_url":"https://api.github.com/repos/Automattic/mongoose","labels_url":"https://api.github.com/repos/Automattic/mongoose/issues/4847/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/mongoose/issues/4847/comments","events_url":"https://api.github.com/repos/Automattic/mongoose/issues/4847/events","html_url":"https://github.com/Automattic/mongoose/issues/4847","id":197953951,"number":4847,"title":"Uncaught, unspecified \"error\" event. (Incorrect arguments)","user":{"login":"freeman29","id":7463696,"avatar_url":"https://avatars1.githubusercontent.com/u/7463696?v=4","gravatar_id":"","url":"https://api.github.com/users/freeman29","html_url":"https://github.com/freeman29","followers_url":"https://api.github.com/users/freeman29/followers","following_url":"https://api.github.com/users/freeman29/following{/other_user}","gists_url":"https://api.github.com/users/freeman29/gists{/gist_id}","starred_url":"https://api.github.com/users/freeman29/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freeman29/subscriptions","organizations_url":"https://api.github.com/users/freeman29/orgs","repos_url":"https://api.github.com/users/freeman29/repos","events_url":"https://api.github.com/users/freeman29/events{/privacy}","received_events_url":"https://api.github.com/users/freeman29/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-12-29T04:58:51Z","updated_at":"2017-12-26T18:32:14Z","closed_at":"2016-12-29T07:22:11Z","author_association":"NONE","body":"Hi guys,\r\n\r\nI'm encountering this error \"Uncaught, unspecified \"error\" event. (Incorrect arguments)\" when trying to login. If this already answered please lead me there.\r\n\r\nHere is my code:\r\n```\r\nrouter.post('/login', function(req, res) {\r\n    User.findOne({\r\n      username: req.body.username\r\n    })\r\n    .select('password')\r\n    .exec(function(err, user) {\r\n      console.log('err', err); // err is null\r\n      if (err) throw err;\r\n\r\n      if (!user) {\r\n        res.status(404).send({message: 'User does not exist!'})\r\n      }\r\n      else if (user) {\r\n        var validPassword = user.comparePassword(req.body.password);\r\n\r\n        if (!validPassword) {\r\n          res.status(401).send({message: 'Invalid Password'});\r\n        }\r\n        else {\r\n          var token = createToken(user);\r\n          res.json({\r\n            success: true,\r\n            message: 'Successfully login!',\r\n            token: token\r\n          })\r\n        }\r\n      }\r\n    })\r\n  })\r\n```\r\nthe exact error:\r\n```\r\nevents.js:165\r\n      throw err;\r\n      ^\r\nError: Uncaught, unspecified \"error\" event. (Incorrect arguments)\r\n    at Function.emit (events.js:163:17)\r\n    at Immediate.<anonymous> (..../node_modules/mongoose/lib/query.js:2322:23)\r\n    at runCallback (timers.js:574:20)\r\n    at tryOnImmediate (timers.js:554:5)\r\n    at processImmediate [as _immediateCallback] (timers.js:533:5)\r\n```\r\n\r\nI'm using:\r\nNode 6.6.0\r\nMongoose 4.7.5\r\nMongoDB 2.4.9"},"comment":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/comments/353998776","html_url":"https://github.com/Automattic/mongoose/issues/4847#issuecomment-353998776","issue_url":"https://api.github.com/repos/Automattic/mongoose/issues/4847","id":353998776,"user":{"login":"Maduflavins","id":16757115,"avatar_url":"https://avatars2.githubusercontent.com/u/16757115?v=4","gravatar_id":"","url":"https://api.github.com/users/Maduflavins","html_url":"https://github.com/Maduflavins","followers_url":"https://api.github.com/users/Maduflavins/followers","following_url":"https://api.github.com/users/Maduflavins/following{/other_user}","gists_url":"https://api.github.com/users/Maduflavins/gists{/gist_id}","starred_url":"https://api.github.com/users/Maduflavins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Maduflavins/subscriptions","organizations_url":"https://api.github.com/users/Maduflavins/orgs","repos_url":"https://api.github.com/users/Maduflavins/repos","events_url":"https://api.github.com/users/Maduflavins/events{/privacy}","received_events_url":"https://api.github.com/users/Maduflavins/received_events","type":"User","site_admin":false},"created_at":"2017-12-26T18:32:14Z","updated_at":"2017-12-26T18:32:14Z","author_association":"NONE","body":"hi guys please am been tormented by same error for days "}}
{"actor":{"display_login":"Maduflavins"}}