badges/shields · error · NotFound

module not found

Error message

module not found

What it means

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.

Source

Thrown at services/luarocks/luarocks.service.js:57

  }

  static defaultBadgeData = {
    label: 'luarocks',
  }

  async fetch({ user, moduleName }) {
    const { repository } = await this._requestJson({
      url: `https://luarocks.org/manifests/${encodeURIComponent(
        user,
      )}/manifest.json`,
      schema,
      httpErrors: {
        404: 'user not found',
      },
    })
    const moduleData = repository[moduleName]
    if (!moduleData) {
      throw new NotFound({ prettyMessage: 'module not found' })
    }
    return moduleData
  }

  async handle({ user, moduleName, version: requestedVersion }) {
    const moduleInfo = await this.fetch({ user, moduleName })

    let version
    if (requestedVersion) {
      if (!(requestedVersion in moduleInfo)) {
        throw new NotFound({ prettyMessage: 'version not found' })
      }
      version = requestedVersion
    } else {
      const versions = Object.keys(moduleInfo)
      version = latestVersion(versions)
    }
    return renderVersionBadge({ version })

View on GitHub (pinned to 766fd8bc89)

Solutions

  1. Verify the exact rock name on luarocks.org under the given user's page.
  2. Correct case and spelling of moduleName in the badge URL.
  3. If the rock was removed/renamed, update the badge to the current name.

Example fix

// before
/luarocks/v/SomeUser/lua-resty-httpx.svg  // wrong rock name
// after
/luarocks/v/SomeUser/lua-resty-http.svg
Defensive patterns

Strategy: validation

Validate before calling

const res = await fetch(`https://luarocks.org/modules/${user}.json`)
const repo = await res.json()
if (!(moduleName in repo)) throw new Error(`Module ${moduleName} not found for user ${user}`)

Type guard

const moduleExists = (repo, name) => repo != null && Object.prototype.hasOwnProperty.call(repo, name)

Try / catch

try {
  return await luarocksService.handle({ user, moduleName })
} catch (e) {
  if (e instanceof NotFound && e.prettyMessage === 'module not found') {
    // render 'rock not found' badge or redirect to user's rock list
  }
  throw e
}

Prevention

When it happens

Trigger: 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.

Common situations: 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).

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of badges/shields@766fd8bc89 (2026-08-30). Data as JSON: /api/errors/4c8492e53d188ca6. Report an issue: GitHub.