{"record":{"id":"492d21309586210e","repo":"badges/shields","slug":"not-very-kind-kind","errorCode":null,"errorMessage":"Not very kind: ${kind}","messagePattern":"Not very kind: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"services/pipenv-helpers.js","lineNumber":59,"sourceCode":" * @param {string} attrs.wantedDependency - Name of the wanted dependency\n * @param {object} attrs.lockfileData - Object containing lock file data\n * @throws {Error} - Error if unknown dependency type provided\n * @throws {InvalidParameter} - Error if wanted dependency is not present in lock file data\n * @throws {InvalidParameter} - Error if version or ref is not present for the wanted dependency\n * @returns {object} Object containing wanted dependency version or ref\n */\nfunction getDependencyVersion({\n  kind = 'default',\n  wantedDependency,\n  lockfileData,\n}) {\n  let dependenciesOfKind\n  if (kind === 'dev') {\n    dependenciesOfKind = lockfileData.develop\n  } else if (kind === 'default') {\n    dependenciesOfKind = lockfileData.default\n  } else {\n    throw Error(`Not very kind: ${kind}`)\n  }\n\n  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    }","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/pipenv-helpers.js#L41-L77","documentation":"getDependencyVersion in services/pipenv-helpers.js resolves a package version from a Pipfile.lock. The lockfile splits dependencies into 'develop' and 'default' sections, and this error is thrown when the caller passes a kind that is neither of those two strings. It is an internal guard against unsupported dependency kinds, thrown as a plain Error rather than a structured InvalidParameter.","triggerScenarios":"Calling getDependencyVersion(lockfileData, wantedDependency, kind) with kind not exactly 'dev' or 'default' — e.g. passing 'development', 'both', undefined, or a user-supplied kind string from config.","commonSituations":"Wiring a badge/service to pipenv-helpers with a hand-written kind argument; a config file where users can specify which dependency section to query; refactoring that renamed 'dev' to 'develop' in a caller but not in getDependencyVersion.","solutions":["Change the caller to pass exactly 'dev' or 'default' as the kind argument","If a user-supplied kind is involved, validate/normalize it before calling (e.g. map 'develop'->'dev', reject others)","If a new lockfile section needs support, extend the if/else chain in getDependencyVersion instead of passing an unmapped value"],"exampleFix":"// before\nconst deps = getDependencyVersion(lockfile, pkg, 'develop')\n// after\nconst deps = getDependencyVersion(lockfile, pkg, 'dev')","handlingStrategy":"validation","validationCode":"const VALID_KINDS = ['dev', 'default']\nif (!VALID_KINDS.includes(kind)) {\n  throw new Error(`Invalid dependency kind: ${kind} (expected 'dev' or 'default')`)\n}","typeGuard":"function isDependencyKind(kind) {\n  return kind === 'dev' || kind === 'default'\n}","tryCatchPattern":"try {\n  const version = getDependencyVersion(lockfile, pkg, kind)\n} catch (err) {\n  if (err.message.startsWith('Not very kind:')) {\n    // normalize alias or surface a friendly message\n    kind = kind === 'develop' ? 'dev' : 'default'\n  } else throw err\n}","preventionTips":["Only pass literal 'dev' or 'default', never free-form strings","Validate user-supplied section names against a whitelist before calling","Add a unit test per supported kind value","Normalize aliases ('develop' -> 'dev') at the boundary"],"tags":["invalid-argument","pipenv","internal-guard"],"backgroundTag":"invalid-argument-value","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}