badges/shields · error · InvalidParameter

${kind} dependency not found

Error message

${kind} dependency not found

What it means

This InvalidParameter error is thrown by getDependencyVersion in pipenv-helpers when the wanted dependency is not present under the requested kind ('default' or 'dev') in the parsed Pipfile.lock data. The lockfile was valid and parsed, but that package is simply not listed in that section.

Source

Thrown at services/pipenv-helpers.js:63

 * @throws {InvalidParameter} - Error if version or ref is not present for the wanted dependency
 * @returns {object} Object containing wanted dependency version or ref
 */
function getDependencyVersion({
  kind = 'default',
  wantedDependency,
  lockfileData,
}) {
  let dependenciesOfKind
  if (kind === 'dev') {
    dependenciesOfKind = lockfileData.develop
  } else if (kind === 'default') {
    dependenciesOfKind = lockfileData.default
  } else {
    throw Error(`Not very kind: ${kind}`)
  }

  if (!(wantedDependency in dependenciesOfKind)) {
    throw new InvalidParameter({
      prettyMessage: `${kind} dependency not found`,
    })
  }

  const { version, ref } = dependenciesOfKind[wantedDependency]

  if (version) {
    // Strip the `==` which is always present.
    return { version: version.replace('==', '') }
  } else if (ref) {
    if (ref.length === 40) {
      // assume it is a commit hash
      return { ref: ref.substring(0, 7) }
    }
    return { ref } // tag
  } else {
    throw new InvalidParameter({
      prettyMessage: `No version or ref for ${wantedDependency}`,

View on GitHub (pinned to 766fd8bc89)

Solutions

  1. Check Pipfile.lock and confirm the package key exists under the correct section ('default' or 'develop') and request it with the matching kind
  2. Regenerate the lockfile with `pipenv lock` if it is stale
  3. Fix the dependency name in the badge URL (Pipfile.lock keys are normalized package names)
  4. Remove the badge if the dependency was intentionally dropped

Example fix

// before
GET /pipenv/dependents/repo/pytest/default  (pytest only in develop)
// after
GET /pipenv/dependents/repo/pytest/dev
Defensive patterns

Strategy: validation

Validate before calling

const lock = JSON.parse(fs.readFileSync('Pipfile.lock', 'utf8'))
const section = kind === 'dev' ? lock.develop : lock.default
if (!section || !(wantedDependency in section)) throw new Error(`${wantedDependency} not found in Pipfile.lock section '${kind}'`)

Type guard

function isInLockfileSection(lockData, dep, kind) {
  const section = kind === 'dev' ? lockData?.develop : lockData?.default
  return typeof section === 'object' && section !== null && dep in section
}

Try / catch

try {
  const v = await getDependencyVersion({ kind, wantedDependency }, lockfileData)
} catch (e) {
  if (e instanceof InvalidParameter && e.message.includes('dependency not found')) console.warn(`Check Pipfile.lock: ${wantedDependency} missing from ${kind} section`)
  else throw e
}

Prevention

When it happens

Trigger: Requesting a dependency badge for a package not in the Pipfile.lock section matching the kind: it is in 'develop' while kind='default', it was removed from the lockfile, or the name casing/key does not match the lockfile key.

Common situations: Badges pointing at dependencies that were removed from the project; mixing up default vs dev dependencies; lockfile regenerated without the package.

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/b94be6fb5ed06d23. Report an issue: GitHub.