{"record":{"id":"0a78e749fc601003","repo":"badges/shields","slug":"license-not-found","errorCode":null,"errorMessage":"license not found","messagePattern":"license not found","errorType":"exception","errorClass":"InvalidResponse","httpStatus":424,"severity":"warning","filePath":"services/greasyfork/greasyfork-license.service.js","lineNumber":25,"sourceCode":"  static route = { base: 'greasyfork', pattern: 'l/:scriptId' }\n\n  static openApi = {\n    '/greasyfork/l/{scriptId}': {\n      get: {\n        summary: 'Greasy Fork License',\n        parameters: pathParams({\n          name: 'scriptId',\n          example: '406540',\n        }),\n      },\n    },\n  }\n\n  static defaultBadgeData = { label: 'license' }\n\n  transform({ data }) {\n    if (data.license === null) {\n      throw new InvalidResponse({\n        prettyMessage: 'license not found',\n      })\n    }\n    // remove suffix \" License\" from data.license\n    return { license: data.license.replace(/ License$/, '') }\n  }\n\n  async handle({ scriptId }) {\n    const data = await this.fetch({ scriptId })\n    const { license } = this.transform({ data })\n    return renderLicenseBadge({ licenses: [license] })\n  }\n}\n","sourceCodeStart":7,"sourceCodeEnd":39,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/greasyfork/greasyfork-license.service.js#L7-L39","documentation":"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.","triggerScenarios":"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.","commonSituations":"Legacy scripts uploaded before license was mandatory on Greasyfork; authors who left the @license metadata out; script deleted its license field on update.","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"],"exampleFix":"// before (script header)\n// ==UserScript==\n// @name My Script\n// ==/UserScript==\n// after\n// ==UserScript==\n// @name My Script\n// @license MIT\n// ==/UserScript==","handlingStrategy":"type-guard","validationCode":"const data = await (await fetch(`https://www.greasyfork.org/api/v2/scripts/${scriptId}`)).json()\nif (data.license == null) console.warn('This script declares no license')","typeGuard":"const hasLicense = (data) => data != null && typeof data.license === 'string' && data.license.length > 0","tryCatchPattern":"try {\n  const { license } = service.transform({ data })\n} catch (e) {\n  if (e.prettyMessage === 'license not found') {\n    // render 'no license' badge\n  } else throw e\n}","preventionTips":["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"],"tags":["greasyfork","license","invalid-response","metadata"],"backgroundTag":"license-missing","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}