{"record":{"id":"5397a71fd6227c66","repo":"neoclide/coc.nvim","slug":"unable-to-load-extension-at-filepath","errorCode":null,"errorMessage":"Unable to load extension at ${filepath}","messagePattern":"Unable to load extension at (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/extension/manager.ts","lineNumber":665,"sourceCode":"   * load extension in folder or file\n   */\n  public async load(filepath: string, active: boolean, options?: ExtensionLoadOptions): Promise<ExportExtension> {\n    let name: string\n    if (options?.sourceCode) {\n      let extensionRoot = options.extensionRoot ?? filepath\n      let obj = loadJson(path.join(extensionRoot, 'package.json')) as any\n      name = obj.name\n      if (!name) throw new Error(`Unable to load extension at ${extensionRoot}, missing package.json`)\n      await this.unloadExtension(name)\n      await this.registerExtension(extensionRoot, obj, ExtensionType.Local, true, options)\n    } else if (isDirectory(filepath)) {\n      let obj = loadJson(path.join(filepath, 'package.json')) as any\n      name = obj.name\n      await this.loadExtension(filepath, true)\n    } else {\n      name = await this.loadExtensionFile(filepath, true)\n    }\n    if (!name) throw new Error(`Unable to load extension at ${filepath}`)\n    let disabled = this.states.isDisabled(name)\n    if (disabled) throw new Error(`extension ${name} is disabled`)\n    let item = this.getExtension(name)\n    if (active) await this.activate(name)\n    return {\n      get isActive() {\n        return item.extension.isActive\n      },\n      get name() {\n        return name\n      },\n      get api() {\n        return item.extension.exports\n      },\n      get exports() {\n        let module = item.extension.module ?? {}\n        return omit(module, ['activate'])\n      },","sourceCodeStart":647,"sourceCodeEnd":683,"githubUrl":"https://github.com/neoclide/coc.nvim/blob/50e974d9692461a69147d5cab146a8d3e439abe4/src/extension/manager.ts#L647-L683","documentation":"Thrown by ExtensionManager.load() when none of the loading paths (directory, single file, sourceCode) yields an extension name, so nothing was registered at the given filepath. Typically the path is neither a directory with a valid package.json nor a loadable extension file.","triggerScenarios":"coc.extensions.load(filepath, active) where filepath is not a directory and loadExtensionFile() returns no name (missing/invalid package.json inside the file's folder, wrong path, non-existent file).","commonSituations":"Typo in extension path; passing a compiled .js file whose sibling package.json is missing; loading from a removed/uninstalled extension directory.","solutions":["Verify the filepath exists (`ls <filepath>`)","If loading a directory, ensure it has a valid package.json with `name`","If loading a single file, ensure a valid package.json exists in its directory","Reinstall/rebuild the extension"],"exampleFix":"// before\nawait coc.extensions.load('~/myext/dist/bundle.js', true)\n// after\nawait coc.extensions.load('~/myext', true) // valid extension root with package.json","handlingStrategy":"try-catch","validationCode":"const fs = require('fs');\nif (!fs.existsSync(filepath)) throw new Error(`path missing: ${filepath}`);\nif (fs.statSync(filepath).isDirectory() && !fs.existsSync(require('path').join(filepath, 'package.json'))) throw new Error('dir lacks package.json');","typeGuard":null,"tryCatchPattern":"try {\n  await coc.extensions.load(filepath, true);\n} catch (e) {\n  if (String(e.message).startsWith('Unable to load extension at')) {\n    console.error(`Cannot load extension from ${filepath}; check path and package.json`);\n  } else throw e;\n}","preventionTips":["Verify path exists before load","Ensure package.json exists at root of directory loads","Reinstall extensions whose folders were manually modified"],"tags":["extension","configuration","load-failure"],"backgroundTag":"extension-load-failed","analyzedSha":"50e974d9692461a69147d5cab146a8d3e439abe4","analyzedAt":"2026-08-31T11:17:23.966Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}