badges/shields · error · InvalidResponse
metadata in unexpected format
Error message
metadata in unexpected format
What it means
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.
Source
Thrown at services/osslifecycle/osslifecycle.service.js:90
color,
}
}
async fetch({ fileUrl }) {
return this._request({
url: fileUrl,
})
}
async handle(pathParams, { file_url: fileUrl = '' }) {
const { buffer } = await this.fetch({
fileUrl,
})
try {
const status = buffer.match(/osslifecycle=([a-z]+)/im)[1]
return this.constructor.render({ status })
} catch (e) {
throw new InvalidResponse({
prettyMessage: 'metadata in unexpected format',
})
}
}
}
View on GitHub (pinned to 766fd8bc89)
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.
Example fix
// before (OSSLifecycle.md) This project is active. // after osslifecycle=active
Defensive patterns
Strategy: validation
Validate before calling
const content = fs.readFileSync('OSSLifecycle.md', 'utf8')
if (!/osslifecycle=([a-z]+)/im.test(content)) {
throw new Error('OSSLifecycle.md must contain a line like: osslifecycle=active')
} Type guard
function hasLifecycleStatus(text) {
const m = text && typeof text === 'string' && text.match(/osslifecycle=([a-z]+)/im)
return Boolean(m && m[1])
} Try / catch
try {
const badge = await getOssLifecycleBadge(repo)
} catch (e) {
if (e.message === 'metadata in unexpected format') {
// fix OSSLifecycle.md format or drop the badge
} else { throw e }
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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`.
Related errors
- version invalid
- unparseable svg response
- unparseable toml response
- unparseable xml response
- unparseable yaml response
AI-assisted analysis of badges/shields@766fd8bc89 (2026-08-30).
Data as JSON: /api/errors/42281d39bfb5c4bb.
Report an issue: GitHub.