Unitech/pm2 · error · Error

Min length of 6

Error message

Min length of 6

What it means

pm2-plus account registration enforces a minimum username length of 6 characters client-side. A shorter value is rejected before the register request is sent.

Source

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

                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)
          return resolve(res)
        }).catch(reject)
    })
  }
}

View on GitHub (pinned to 31adee8048)

Solutions

  1. Choose a username of at least 6 characters.
Defensive patterns

Strategy: validation

Validate before calling

if (typeof username !== 'string' || username.trim().length < 6) {
  throw new Error('Username must be at least 6 characters');
}

Type guard

const isValidUsername = (v) => typeof v === 'string' && v.trim().length >= 6;

Prevention

When it happens

Trigger: Entering a username shorter than 6 characters at the `pm2 plus register` prompt.

Common situations: Trying a short handle or initials as a username.

Related errors


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