{"record":{"id":"42281d39bfb5c4bb","repo":"badges/shields","slug":"metadata-in-unexpected-format","errorCode":null,"errorMessage":"metadata in unexpected format","messagePattern":"metadata in unexpected format","errorType":"exception","errorClass":"InvalidResponse","httpStatus":null,"severity":"error","filePath":"services/osslifecycle/osslifecycle.service.js","lineNumber":90,"sourceCode":"      color,\n    }\n  }\n\n  async fetch({ fileUrl }) {\n    return this._request({\n      url: fileUrl,\n    })\n  }\n\n  async handle(pathParams, { file_url: fileUrl = '' }) {\n    const { buffer } = await this.fetch({\n      fileUrl,\n    })\n    try {\n      const status = buffer.match(/osslifecycle=([a-z]+)/im)[1]\n      return this.constructor.render({ status })\n    } catch (e) {\n      throw new InvalidResponse({\n        prettyMessage: 'metadata in unexpected format',\n      })\n    }\n  }\n}\n","sourceCodeStart":72,"sourceCodeEnd":96,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/osslifecycle/osslifecycle.service.js#L72-L96","documentation":"The OSSLifecycle service fetches a repo's OSSLifecycle.md file and extracts the status with the regex /osslifecycle=([a-z]+)/im. If the file is missing the `osslifecycle=<value>` line (or it is formatted differently), the match returns null and the code throws InvalidResponse with this message.","triggerScenarios":"The OSSLifecycle.md file exists but does not contain a line matching `osslifecycle=` followed by lowercase letters — e.g. empty file, value contains digits/hyphens/uppercase-only format like `osslifecycle-attribute = active`, or the marker is misspelled.","commonSituations":"Repos where the file was renamed or its content template changed; lifecycle values written as `active-maintenance` (hyphen breaks [a-z]+); files with different casing/spacing such as `osslifecycle: active`.","solutions":["Ensure OSSLifecycle.md contains a line of the form `osslifecycle=active` (lowercase value, equals sign, no spaces).","Check the value only uses lowercase a-z characters, or update the file to a supported format.","Confirm the file is at the repo root (or the fileUrl the badge fetches) and is named exactly OSSLifecycle.md.","If a legitimate format is rejected, the service regex needs widening — file an issue upstream."],"exampleFix":"// before (OSSLifecycle.md)\nThis project is active.\n// after\nosslifecycle=active","handlingStrategy":"validation","validationCode":"const content = fs.readFileSync('OSSLifecycle.md', 'utf8')\nif (!/osslifecycle=([a-z]+)/im.test(content)) {\n  throw new Error('OSSLifecycle.md must contain a line like: osslifecycle=active')\n}","typeGuard":"function hasLifecycleStatus(text) {\n  const m = text && typeof text === 'string' && text.match(/osslifecycle=([a-z]+)/im)\n  return Boolean(m && m[1])\n}","tryCatchPattern":"try {\n  const badge = await getOssLifecycleBadge(repo)\n} catch (e) {\n  if (e.message === 'metadata in unexpected format') {\n    // fix OSSLifecycle.md format or drop the badge\n  } else { throw e }\n}","preventionTips":["Use the exact format `osslifecycle=active` — lowercase value, equals sign, no spaces","Values with hyphens or digits (e.g. active-maintenance) break the [a-z]+ regex","Keep the file at the repo root named exactly OSSLifecycle.md"],"tags":["parsing","regex","invalid-response","markdown"],"backgroundTag":"unexpected-response-format","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}