{"record":{"id":"b1c3011f3170579c","repo":"badges/shields","slug":"version-missing-in-filename","errorCode":null,"errorMessage":"Version missing in ${filename}","messagePattern":"Version missing in (.+?)","errorType":"exception","errorClass":"InvalidResponse","httpStatus":424,"severity":"error","filePath":"services/github/github-r-package.service.js","lineNumber":73,"sourceCode":"        ],\n      },\n    },\n  }\n\n  static defaultBadgeData = { label: 'R' }\n\n  static render({ version, branch }) {\n    return renderVersionBadge({\n      version,\n      tag: branch,\n      defaultLabel: 'R',\n    })\n  }\n\n  static transform(content, filename) {\n    const match = versionRegExp.exec(content)\n    if (!match) {\n      throw new InvalidResponse({\n        prettyMessage: `Version missing in ${filename}`,\n      })\n    }\n\n    return {\n      version: match[1],\n    }\n  }\n\n  async handle({ user, repo, branch }, { filename = 'DESCRIPTION' }) {\n    const content = await fetchRepoContent(this, {\n      user,\n      repo,\n      branch,\n      filename,\n    })\n    const { version } = this.constructor.transform(content, filename)\n    return this.constructor.render({ version, branch })","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/github/github-r-package.service.js#L55-L91","documentation":"The GitHub R-package service extracts the version from a package DESCRIPTION file using `versionRegExp`. If the regex finds no `Version:` field in the fetched content, `transform` throws `InvalidResponse` with 'Version missing in <filename>'. The file was downloaded fine, but it does not look like a valid R package DESCRIPTION.","triggerScenarios":"Fetching the DESCRIPTION from a repo/path where the file lacks a `Version:` line; the URL points at a different file (e.g. wrong filename or an HTML error page saved as the file); the branch's DESCRIPTION is malformed.","commonSituations":"Path/filename typo in the badge URL so a non-DESCRIPTION file is fetched; R package source without a Version field (unusual but possible in hand-written DESCRIPTION); branch where DESCRIPTION was edited and the Version line deleted; serving a 404 HTML page at the expected path.","solutions":["Add a `Version: x.y.z` field to the DESCRIPTION file","Verify the badge URL's filename/path points at the real DESCRIPTION on the intended branch","Check the fetched content on GitHub to confirm it is the R package DESCRIPTION, not an error page"],"exampleFix":"// before (DESCRIPTION)\nPackage: mypkg\n// after\nPackage: mypkg\nVersion: 1.2.3","handlingStrategy":"validation","validationCode":"const content = await fetch(rawDescriptionUrl).then(r => r.text())\nif (!/^Version:\\s*.+$/m.test(content)) {\n  throw new Error('DESCRIPTION lacks a Version field')\n}","typeGuard":"null","tryCatchPattern":"try {\n  await fetchRPackageBadge(user, repo, path)\n} catch (e) {\n  if (/^Version missing in /.test(e.message)) return 'version unknown'\n  throw e\n}","preventionTips":["Always keep a `Version:` field in your R package DESCRIPTION","Verify the badge URL points at the real DESCRIPTION file on the right branch","Inspect the raw file on GitHub when the badge errors"],"tags":["github","r","parse-error","missing-field"],"backgroundTag":"expected-field-missing-in-file","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}