badges/shields · error · NotFound

version not found

Error message

version not found

What it means

After fetching module info, handle() resolves which version to report. If the URL specifies a requestedVersion and that version key is not present in the module's version map, it throws NotFound('version not found'). Without a requested version, the latest is chosen instead and this error cannot occur.

Source

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

      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. Check the module's version list on luarocks.org and use an existing version string.
  2. Remove the version segment from the badge URL to report the latest version.
  3. Update the version in the URL if the project released a newer version.

Example fix

// before
/luarocks/v/user/module/0.9.0.svg  // 0.9.0 deleted
// after
/luarocks/v/user/module/1.0.0.svg
Defensive patterns

Strategy: validation

Validate before calling

const versions = Object.keys(await luarocksService.fetch({ user, moduleName }))
if (requestedVersion && !versions.includes(requestedVersion)) throw new Error(`Version ${requestedVersion} not published`)

Type guard

const hasVersion = (moduleInfo, v) => moduleInfo != null && Object.prototype.hasOwnProperty.call(moduleInfo, v)

Try / catch

try {
  return await luarocksService.handle({ user, moduleName, version })
} catch (e) {
  if (e instanceof NotFound && e.prettyMessage === 'version not found') {
    // fall back to latest-version badge or show 'unknown version'
  }
  throw e
}

Prevention

When it happens

Trigger: Requesting a LuaRocks badge pinned to a version string that does not exist for the module, e.g. /luarocks/v/user/module/1.2.3 where 1.2.3 was never released or was deleted.

Common situations: Stale documentation or READMEs referencing old versions, typos in the version string, or the rock author having removed that version from LuaRocks.

Related errors


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