{"record":{"id":"4c8492e53d188ca6","repo":"badges/shields","slug":"module-not-found","errorCode":null,"errorMessage":"module not found","messagePattern":"module not found","errorType":"exception","errorClass":"NotFound","httpStatus":404,"severity":"error","filePath":"services/luarocks/luarocks.service.js","lineNumber":57,"sourceCode":"  }\n\n  static defaultBadgeData = {\n    label: 'luarocks',\n  }\n\n  async fetch({ user, moduleName }) {\n    const { repository } = await this._requestJson({\n      url: `https://luarocks.org/manifests/${encodeURIComponent(\n        user,\n      )}/manifest.json`,\n      schema,\n      httpErrors: {\n        404: 'user not found',\n      },\n    })\n    const moduleData = repository[moduleName]\n    if (!moduleData) {\n      throw new NotFound({ prettyMessage: 'module not found' })\n    }\n    return moduleData\n  }\n\n  async handle({ user, moduleName, version: requestedVersion }) {\n    const moduleInfo = await this.fetch({ user, moduleName })\n\n    let version\n    if (requestedVersion) {\n      if (!(requestedVersion in moduleInfo)) {\n        throw new NotFound({ prettyMessage: 'version not found' })\n      }\n      version = requestedVersion\n    } else {\n      const versions = Object.keys(moduleInfo)\n      version = latestVersion(versions)\n    }\n    return renderVersionBadge({ version })","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/luarocks/luarocks.service.js#L39-L75","documentation":"The LuaRocks service fetches a user's module manifest from the LuaRocks repository API. After mapping the configured 404 to 'user not found', it checks whether the requested module name exists in the returned repository object; if repository[moduleName] is undefined, it throws NotFound('module not found'). The user exists but has no rock with that name.","triggerScenarios":"Calling the badge with a user who exists on LuaRocks but a moduleName that is not among their published rocks, causing repository[moduleName] to be undefined.","commonSituations":"Typos in the rock name, the rock having been removed or renamed on LuaRocks, or confusing the rock display name with its exact module name (case-sensitive).","solutions":["Verify the exact rock name on luarocks.org under the given user's page.","Correct case and spelling of moduleName in the badge URL.","If the rock was removed/renamed, update the badge to the current name."],"exampleFix":"// before\n/luarocks/v/SomeUser/lua-resty-httpx.svg  // wrong rock name\n// after\n/luarocks/v/SomeUser/lua-resty-http.svg","handlingStrategy":"validation","validationCode":"const res = await fetch(`https://luarocks.org/modules/${user}.json`)\nconst repo = await res.json()\nif (!(moduleName in repo)) throw new Error(`Module ${moduleName} not found for user ${user}`)","typeGuard":"const moduleExists = (repo, name) => repo != null && Object.prototype.hasOwnProperty.call(repo, name)","tryCatchPattern":"try {\n  return await luarocksService.handle({ user, moduleName })\n} catch (e) {\n  if (e instanceof NotFound && e.prettyMessage === 'module not found') {\n    // render 'rock not found' badge or redirect to user's rock list\n  }\n  throw e\n}","preventionTips":["Verify the exact rock name on luarocks.org before embedding a badge.","Remember rock names are case-sensitive; copy from the rock's page URL.","Set up link checkers to catch badges for rocks that get renamed or removed."],"tags":["luarocks","not-found","lua"],"backgroundTag":"resource-not-found","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}