{"record":{"id":"8cfd80a329f8b9b7","repo":"neoclide/coc.nvim","slug":"this-def-is-not-a-valid-coc-extension-engines","errorCode":null,"errorMessage":"${this.def} is not a valid coc extension, \"engines\" field with coc property required.","messagePattern":"(.+?) is not a valid coc extension, \"engines\" field with coc property required\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/extension/installer.ts","lineNumber":236,"sourceCode":"          let versions = Object.keys(res.versions ?? {}).filter(version => {\n            let published = Date.parse(res.time?.[version])\n            return Number.isFinite(published) && published <= cutoff\n          })\n          this.version = semver.maxSatisfying(versions, '*') ?? undefined\n          if (!this.version) throw new Error(`${this.def} has no release older than ${releaseAge} days.`)\n        }\n      }\n    } else if (releaseAge > 0) {\n      let published = Date.parse(res.time?.[this.version])\n      let cutoff = Date.now() - releaseAge * 24 * 60 * 60 * 1000\n      if (!Number.isFinite(published) || published > cutoff) {\n        throw new Error(`${this.def} is not older than ${releaseAge} days.`)\n      }\n    }\n    let obj = res['versions'][this.version]\n    if (!obj) throw new Error(`${this.def} doesn't exists in ${registry}.`)\n    let requiredVersion = obj['engines'] && obj['engines']['coc']\n    if (!requiredVersion) throw new Error(`${this.def} is not a valid coc extension, \"engines\" field with coc property required.`)\n    extensionPath(this.root, res.name)\n    return {\n      'dist.tarball': obj['dist']['tarball'],\n      'engines.coc': requiredVersion,\n      version: obj['version'],\n      name: res.name\n    } as Info\n  }\n\n  public async getInfoFromUri(): Promise<Info> {\n    let { url } = this\n    let repository: URL\n    try {\n      repository = new URL(url)\n    } catch (_e) {\n      throw new Error(`\"${url}\" is not supported, coc.nvim support github.com only`)\n    }\n    if (repository.protocol !== 'https:' || repository.hostname !== 'github.com') {","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/neoclide/coc.nvim/blob/50e974d9692461a69147d5cab146a8d3e439abe4/src/extension/installer.ts#L218-L254","documentation":" thrown when the registry metadata for the chosen version lacks an 'engines' object with a 'coc' property. coc.nvim requires extensions to declare which coc.nvim engine versions they support; without it the package is not treated as a valid coc extension.","triggerScenarios":"getInfo resolves a registry version whose package.json has no engines.coc field — e.g. installing an arbitrary npm package by name that is not a coc extension.","commonSituations":"Misspelling an extension name so a non-coc npm package is installed; a broken/misconfigured extension package; very old or hand-built packages predating the engines.coc convention.","solutions":["Verify the package is a real coc extension (its package.json contains \"engines\": {\"coc\": ...}).","Check the extension name spelling in the def/url.","If it is your own extension, add engines: { \"coc\": \">=x.y.z\" } to package.json and publish.","If using a custom branch/tarball, make sure it builds a proper package.json with engines.coc."],"exampleFix":"// package.json of the extension\n// before\n{ \"name\": \"my-ext\", \"version\": \"1.0.0\" }\n// after\n{ \"name\": \"my-ext\", \"version\": \"1.0.0\", \"engines\": { \"coc\": \">=0.0.80\" } }","handlingStrategy":"validation","validationCode":"const meta = await npmView(name)\nif (!(meta.engines && meta.engines.coc)) throw new Error(`${name} is not a coc extension`)\nawait installer.install()","typeGuard":"function isCocExt(pkg) { return !!pkg && typeof pkg.engines === 'object' && pkg.engines !== null && typeof pkg.engines.coc === 'string' }","tryCatchPattern":"try { await installer.install() } catch (e) { if (e.message.includes('is not a valid coc extension')) { /* notify: wrong package name / not a coc ext */ } else { throw e } }","preventionTips":["Only install packages from the coc extension ecosystem","Check engines.coc in package.json before packaging your own extension","Double-check extension names for typos"],"tags":["npm-registry","package-metadata","extension-install"],"backgroundTag":"missing-package-engines-field","analyzedSha":"50e974d9692461a69147d5cab146a8d3e439abe4","analyzedAt":"2026-08-31T11:17:23.966Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}