badges/shields · warning · InvalidResponse
license not found
Error message
license not found
What it means
The Greasyfork license service throws this InvalidResponse when the Greasyfork API returns license === null, meaning the user script has no declared license. The service requires a non-null license string to strip the ' License' suffix and render the badge.
Source
Thrown at services/greasyfork/greasyfork-license.service.js:25
static route = { base: 'greasyfork', pattern: 'l/:scriptId' }
static openApi = {
'/greasyfork/l/{scriptId}': {
get: {
summary: 'Greasy Fork License',
parameters: pathParams({
name: 'scriptId',
example: '406540',
}),
},
},
}
static defaultBadgeData = { label: 'license' }
transform({ data }) {
if (data.license === null) {
throw new InvalidResponse({
prettyMessage: 'license not found',
})
}
// remove suffix " License" from data.license
return { license: data.license.replace(/ License$/, '') }
}
async handle({ scriptId }) {
const data = await this.fetch({ scriptId })
const { license } = this.transform({ data })
return renderLicenseBadge({ licenses: [license] })
}
}
View on GitHub (pinned to 766fd8bc89)
Solutions
- Add a @license declaration to the user script header and update it on Greasyfork
- Set the license in the script's code metadata (e.g. // @license MIT) and push an update
- If no license is intended, remove the license badge from the README
Example fix
// before (script header) // ==UserScript== // @name My Script // ==/UserScript== // after // ==UserScript== // @name My Script // @license MIT // ==/UserScript==
Defensive patterns
Strategy: type-guard
Validate before calling
const data = await (await fetch(`https://www.greasyfork.org/api/v2/scripts/${scriptId}`)).json()
if (data.license == null) console.warn('This script declares no license') Type guard
const hasLicense = (data) => data != null && typeof data.license === 'string' && data.license.length > 0
Try / catch
try {
const { license } = service.transform({ data })
} catch (e) {
if (e.prettyMessage === 'license not found') {
// render 'no license' badge
} else throw e
} Prevention
- Always include // @license in user script metadata
- Check the Greasyfork API response's license field before adding the badge
- For scripts without a license, use a different badge type
When it happens
Trigger: Requesting a license badge for a script whose author did not set a license in the script metadata; scripts using @@license==none or an unspecified license on Greasyfork.
Common situations: Legacy scripts uploaded before license was mandatory on Greasyfork; authors who left the @license metadata out; script deleted its license field on update.
Related errors
- not specified
- property 'latest' not found
- property 'release' not found
- no versions found
- invalid json response
AI-assisted analysis of badges/shields@766fd8bc89 (2026-08-30).
Data as JSON: /api/errors/0a78e749fc601003.
Report an issue: GitHub.