{"record":{"id":"bb08591b1ac141eb","repo":"badges/shields","slug":"no-version-or-ref-for-wanteddependency","errorCode":null,"errorMessage":"No version or ref for ${wantedDependency}","messagePattern":"No version or ref for (.+?)","errorType":"validation","errorClass":"InvalidParameter","httpStatus":null,"severity":"error","filePath":"services/pipenv-helpers.js","lineNumber":80,"sourceCode":"  if (!(wantedDependency in dependenciesOfKind)) {\n    throw new InvalidParameter({\n      prettyMessage: `${kind} dependency not found`,\n    })\n  }\n\n  const { version, ref } = dependenciesOfKind[wantedDependency]\n\n  if (version) {\n    // Strip the `==` which is always present.\n    return { version: version.replace('==', '') }\n  } else if (ref) {\n    if (ref.length === 40) {\n      // assume it is a commit hash\n      return { ref: ref.substring(0, 7) }\n    }\n    return { ref } // tag\n  } else {\n    throw new InvalidParameter({\n      prettyMessage: `No version or ref for ${wantedDependency}`,\n    })\n  }\n}\n\nexport { isLockfile, getDependencyVersion }\n","sourceCodeStart":62,"sourceCodeEnd":87,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/pipenv-helpers.js#L62-L87","documentation":"This InvalidParameter error is thrown when the dependency WAS found in the lockfile but its entry contains neither a usable version nor a ref (both missing/null). Pipfile.lock entries normally carry a version like '==1.2.3' or a git ref; an entry without either cannot produce a badge.","triggerScenarios":"A hand-edited or corrupted Pipfile.lock where the dependency object lacks 'version' and 'ref'; lockfile written by a tool variant that stores resolution differently.","commonSituations":"Manual lockfile editing, merge conflicts resolved badly inside Pipfile.lock, or exotic dependency entries (e.g. file/path deps) that omit version metadata.","solutions":["Regenerate the lockfile with `pipenv lock` so every entry has version or ref metadata","Inspect the offending entry in Pipfile.lock and restore the missing 'version' or 'ref' field","Avoid hand-editing Pipfile.lock; use `pipenv install pkg==x.y.z` then relock","Check for unresolved git-merge markers in Pipfile.lock"],"exampleFix":"// before (Pipfile.lock)\n\"requests\": { \"hashes\": [...] }\n// after\n\"requests\": { \"version\": \"==2.31.0\", \"hashes\": [...] }","handlingStrategy":"validation","validationCode":"const entry = lock.default[wantedDependency]\nif (!entry || (!entry.version && !entry.ref)) throw new Error(`Lockfile entry for ${wantedDependency} has neither version nor ref; relock with pipenv lock`)","typeGuard":"function hasVersionOrRef(entry) {\n  return typeof entry === 'object' && entry !== null && (typeof entry.version === 'string' || typeof entry.ref === 'string')\n}","tryCatchPattern":"try {\n  const v = await getDependencyVersion({ kind, wantedDependency }, lockfileData)\n} catch (e) {\n  if (e instanceof InvalidParameter && e.message.startsWith('No version or ref')) console.warn(`Malformed lockfile entry for ${wantedDependency}; run 'pipenv lock'`)\n  else throw e\n}","preventionTips":["Never hand-edit Pipfile.lock; relock instead","Resolve merge conflicts in Pipfile.lock by regenerating, not by hand","Sanity-check entries for version/ref fields in CI before deploying badges"],"tags":["pipenv","python","lockfile","malformed-data"],"backgroundTag":"malformed-lockfile","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}