{"record":{"id":"0b16c190509746c1","repo":"neoclide/coc.nvim","slug":"errors-0","errorCode":null,"errorMessage":"errors[0]","messagePattern":"errors\\[0\\]","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/extension/manager.ts","lineNumber":322,"sourceCode":"    await Promise.resolve(item.deactivate())\n  }\n\n  /**\n   * Load extension from folder, folder should contains coc extension.\n   */\n  public async loadExtension(folder: string | string[], noActive = false): Promise<boolean> {\n    if (Array.isArray(folder)) {\n      let results = await Promise.allSettled(folder.map(f => {\n        return this.loadExtension(f, noActive)\n      }))\n      results.forEach(res => {\n        if (res.status === 'rejected') throw new Error(`Error on loadExtension ${res.reason}`)\n      })\n      return true\n    }\n    let errors: string[] = []\n    let obj = loadExtensionJson(folder, workspace.version, errors)\n    if (errors.length > 0) throw new Error(errors[0])\n    let { name } = obj\n    if (this.states.isDisabled(name)) return false\n    // unload if loaded\n    await this.unloadExtension(name)\n    let isLocal = !this.states.hasExtension(name)\n    if (isLocal) this.states.addLocalExtension(name, folder)\n    await this.registerExtension(folder, Object.freeze(obj), isLocal ? ExtensionType.Local : ExtensionType.Global, noActive)\n    return true\n  }\n\n  /**\n   * Deactivate & unregist extension\n   */\n  public async unloadExtension(id: string): Promise<void> {\n    let item = this.extensions.get(id)\n    if (item) {\n      await this.deactivate(id)\n      this.extensions.delete(id)","sourceCodeStart":304,"sourceCodeEnd":340,"githubUrl":"https://github.com/neoclide/coc.nvim/blob/50e974d9692461a69147d5cab146a8d3e439abe4/src/extension/manager.ts#L304-L340","documentation":"In loadExtension (src/extension/manager.ts) the single-folder path calls loadExtensionJson(folder, workspace.version, errors), which accumulates problems (unreadable folder, bad JSON, engine/version mismatch) in the `errors` array. If any errors were collected, the first one is thrown verbatim as the exception message.","triggerScenarios":"loadExtension(folder) where the folder lacks a valid extension manifest, the JSON cannot be parsed, or the extension declares engine/version requirements incompatible with the current workspace.version.","commonSituations":"Manually installing an extension folder without package.json; extension requiring a newer/older coc.nvim version; corrupt package.json after an interrupted install; pointing configuration at the wrong directory.","solutions":["Read the thrown message — it is the first collector error — and fix that specific problem (usually the manifest)","Ensure the folder has a valid package.json with name, main and compatible engines","Check the extension's engines.coc version requirement against your coc.nvim version and upgrade/downgrade accordingly","Reinstall the extension from its source to restore a clean manifest"],"exampleFix":"// before: folder without manifest\nawait manager.loadExtension('~/.vim/my-ext') // throws errors[0]\n// after: install properly so package.json exists\nawait manager.loadExtension('~/.vim/plugged/my-ext')","handlingStrategy":"validation","validationCode":"const pkgPath = path.join(folder, 'package.json')\nif (!fs.existsSync(pkgPath)) throw new Error(`missing manifest: ${pkgPath}`)\nconst pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'))\nif (!pkg.name || !pkg.main) throw new Error(`incomplete manifest: ${pkgPath}`)","typeGuard":null,"tryCatchPattern":"try {\n  await manager.loadExtension(folder)\n} catch (e) {\n  logger.error(`loadExtension failed: ${e.message}`) // message is errors[0]\n}","preventionTips":["Always install extensions via their full directory (package.json at root)","Check the extension's engines.coc requirement against your coc.nvim version","Reinstall extensions whose installs were interrupted","Catch and display errors[0] clearly — it names the concrete problem"],"tags":["extension-loading","manifest","version-compatibility"],"backgroundTag":"extension-manifest-invalid","analyzedSha":"50e974d9692461a69147d5cab146a8d3e439abe4","analyzedAt":"2026-08-31T11:17:23.966Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}