{"record":{"id":"0765f0a58457fb56","repo":"Unitech/pm2","slug":"min-length-of-6","errorCode":null,"errorMessage":"Min length of 6","messagePattern":"Min length of 6","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/API/pm2-plus/auth-strategies/CliAuth.js","lineNumber":289,"sourceCode":"                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)\n          return resolve(res)\n        }).catch(reject)\n    })\n  }\n}\n","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/Unitech/pm2/blob/31adee8048dbbc1ee36a7df7cdbcaca2559708df/lib/API/pm2-plus/auth-strategies/CliAuth.js#L271-L307","documentation":"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.","triggerScenarios":"Entering a username shorter than 6 characters at the `pm2 plus register` prompt.","commonSituations":"Trying a short handle or initials as a username.","solutions":["Choose a username of at least 6 characters."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (typeof username !== 'string' || username.trim().length < 6) {\n  throw new Error('Username must be at least 6 characters');\n}","typeGuard":"const isValidUsername = (v) => typeof v === 'string' && v.trim().length >= 6;","tryCatchPattern":null,"preventionTips":["Enforce a minimum length in your prompt before submitting.","Avoid usernames that are initials or very short handles."],"tags":["auth","validation","username"],"backgroundTag":null,"analyzedSha":"31adee8048dbbc1ee36a7df7cdbcaca2559708df","analyzedAt":"2026-08-13T03:49:51.765Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}