Unitech/pm2 · error · Error

Not an email

Error message

Not an email

What it means

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.

Source

Thrown at lib/API/pm2-plus/auth-strategies/CliAuth.js:283

                'Cookie': cookie
              },
              body: JSON.stringify({
                client_id : this.client_id,
                grant_type : 'refresh_token',
                refresh_token : refresh_token,
                scope : 'all'
              })
            }).then(res => res.json()).then(body => cb(null, body));
          });
        });
      })
      .catch(err => cb(err));
  }

  _validateEmail (email) {
    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,}))$/;
    if (re.test(email) == false)
      throw new Error('Not an email');
    return email;
  }

  _validateUsername (value) {
    if (value.length < 6) {
      throw new Error('Min length of 6');
    }
    return value;
  };

  deleteTokens (km) {
    return new Promise((resolve, reject) => {
      // revoke the refreshToken
      km.auth.revoke()
        .then(res => {
          // remove the token from the filesystem
          let file = cst.PM2_IO_ACCESS_TOKEN
          fs.unlinkSync(file)

View on GitHub (pinned to 31adee8048)

Solutions

  1. Re-enter the email in standard user@host.tld form.
  2. Trim leading/trailing whitespace before submitting.
Defensive patterns

Strategy: validation

Validate before calling

const isEmail = (s) => typeof s === 'string' && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s.trim());
if (!isEmail(email)) throw new Error('Please enter a valid email address');

Type guard

const isEmailLike = (s) => typeof s === 'string' && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s.trim());

Prevention

When it happens

Trigger: Entering a malformed email at the interactive `pm2 plus register` / `pm2 plus login` prompt — missing @, invalid domain, trailing spaces.

Common situations: Typo in the email, copy-paste artifacts, autocorrect, or passing an empty string.

Related errors


AI-assisted analysis of Unitech/pm2@31adee8048 (2026-08-13). Data as JSON: /api/errors/954c946d54fe0562. Report an issue: GitHub.