{"record":{"id":"3f6b3a5f2f08cc48","repo":"Unitech/pm2","slug":"no-app-name-defined","errorCode":null,"errorMessage":"No app_name defined","messagePattern":"No app_name defined","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/API/Modules/NPM.js","lineNumber":328,"sourceCode":"  Configuration.unsetSync(cst.MODULE_CONF_PREFIX + ':' + module_name_only);\n\n  CLI.deleteModule(module_name_only, function(err, data) {\n    console.log('Deleting', proc_path)\n    if (module_name != '.' && proc_path.includes('modules') === true) {\n      deleteFolderRecursive(proc_path)\n    }\n\n    if (err) {\n      Common.printError(err);\n      return cb(err);\n    }\n\n    return cb(null, data);\n  });\n}\n\nfunction getModuleConf(app_name) {\n  if (!app_name) throw new Error('No app_name defined');\n\n  var module_conf = Configuration.getAllSync();\n\n  var additional_env = {};\n\n  if (!module_conf[app_name]) {\n    additional_env = {};\n    additional_env[app_name] = {};\n  }\n  else {\n    additional_env = Common.clone(module_conf[app_name]);\n    additional_env[app_name] = JSON.stringify(module_conf[app_name]);\n  }\n  return additional_env;\n}\n\nfunction StartModule(CLI, opts, cb) {\n  if (!opts.cmd && !opts.package) throw new Error('module package.json not defined');","sourceCodeStart":310,"sourceCodeEnd":346,"githubUrl":"https://github.com/Unitech/pm2/blob/31adee8048dbbc1ee36a7df7cdbcaca2559708df/lib/API/Modules/NPM.js#L310-L346","documentation":"getModuleConf is an internal helper in the NPM module loader that reads per-module configuration from PM2's Configuration store, keyed by app_name. It is a hard precondition: it must receive a non-empty module identifier, otherwise it has nothing to look up.","triggerScenarios":"Internal code path invokes getModuleConf() with undefined/empty/'' because the module name could not be resolved upstream (e.g. a module install where getCanonicModuleName returned empty).","commonSituations":"Programmatic wrappers around PM2's module install/start API that pass an opts object missing a resolvable name; installing a module whose tarball/dir has no parseable name.","solutions":["Resolve and pass a valid module name string to the module install/start flow.","Verify the module source (git URL, tarball, dir) yields a canonical name before invoking module APIs."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const name = require('./Utility').getCanonicModuleName(rawName);\nif (!name || typeof name !== 'string') {\n  throw new Error('Could not resolve a module name before reading module config');\n}","typeGuard":"const isNonEmptyString = (v) => typeof v === 'string' && v.trim().length > 0;","tryCatchPattern":null,"preventionTips":["Validate that a canonical module name resolves to a non-empty string before invoking module install/start.","Surface upstream name-resolution failures explicitly rather than letting them reach internal helpers."],"tags":["modules","internal","precondition"],"backgroundTag":null,"analyzedSha":"31adee8048dbbc1ee36a7df7cdbcaca2559708df","analyzedAt":"2026-08-13T03:49:51.765Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}