{"record":{"id":"954c946d54fe0562","repo":"Unitech/pm2","slug":"not-an-email","errorCode":null,"errorMessage":"Not an email","messagePattern":"Not an email","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/API/pm2-plus/auth-strategies/CliAuth.js","lineNumber":283,"sourceCode":"                'Cookie': cookie\n              },\n              body: JSON.stringify({\n                client_id : this.client_id,\n                grant_type : 'refresh_token',\n                refresh_token : refresh_token,\n                scope : 'all'\n              })\n            }).then(res => res.json()).then(body => cb(null, body));\n          });\n        });\n      })\n      .catch(err => cb(err));\n  }\n\n  _validateEmail (email) {\n    var re = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n    if (re.test(email) == false)\n      throw new Error('Not an email');\n    return email;\n  }\n\n  _validateUsername (value) {\n    if (value.length < 6) {\n      throw new Error('Min length of 6');\n    }\n    return value;\n  };\n\n  deleteTokens (km) {\n    return new Promise((resolve, reject) => {\n      // revoke the refreshToken\n      km.auth.revoke()\n        .then(res => {\n          // remove the token from the filesystem\n          let file = cst.PM2_IO_ACCESS_TOKEN\n          fs.unlinkSync(file)","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/Unitech/pm2/blob/31adee8048dbbc1ee36a7df7cdbcaca2559708df/lib/API/pm2-plus/auth-strategies/CliAuth.js#L265-L301","documentation":"During pm2.io / pm2-plus signup or signin, the CLI collects an email and validates it against an RFC-ish regex before sending it to the auth endpoint. A string that doesn't match (no @, bad TLD, embedded spaces) is rejected client-side before any network call.","triggerScenarios":"Entering a malformed email at the interactive `pm2 plus register` / `pm2 plus login` prompt — missing @, invalid domain, trailing spaces.","commonSituations":"Typo in the email, copy-paste artifacts, autocorrect, or passing an empty string.","solutions":["Re-enter the email in standard user@host.tld form.","Trim leading/trailing whitespace before submitting."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const isEmail = (s) => typeof s === 'string' && /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(s.trim());\nif (!isEmail(email)) throw new Error('Please enter a valid email address');","typeGuard":"const isEmailLike = (s) => typeof s === 'string' && /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(s.trim());","tryCatchPattern":null,"preventionTips":["Trim and validate email in your own prompt loop before handing it to the CLI.","Reject empty strings and values containing spaces early."],"tags":["auth","validation","email"],"backgroundTag":null,"analyzedSha":"31adee8048dbbc1ee36a7df7cdbcaca2559708df","analyzedAt":"2026-08-13T03:49:51.765Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}