{"record":{"id":"75f1f3c1981132cd","repo":"neoclide/coc.nvim","slug":"unsupported-native-addon-cachekey","errorCode":null,"errorMessage":"Unsupported native addon: ${cacheKey}","messagePattern":"Unsupported native addon: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/extension/loader.ts","lineNumber":271,"sourceCode":"    if (ext === '.js' || ext === '.cjs' || ext === '') return this.loadJavaScript(cacheKey, parent)\n    if (ext === '.mjs') throw requireESMError(cacheKey)\n    throw new Error(`Unsupported module type \"${ext}\" for ${cacheKey}`)\n  }\n\n  /**\n   * Load a native addon outside the VM. The addon is dlopen'd by Node and its\n   * exports are cached in the runtime module cache.\n   */\n  public loadNative(filename: string, parent?: ExtensionCommonJSModule): unknown {\n    const cacheKey = this.normalizeFilename(filename)\n    const cached = this.runtime.cjsModules.get(cacheKey)\n    if (cached) return cached.exports\n    const nodeModule = new Module(cacheKey)\n    nodeModule.filename = cacheKey\n    nodeModule.paths = Module._nodeModulePaths(path.dirname(cacheKey))\n    const nativeLoad = Module._extensions && Module._extensions['.node']\n    if (typeof nativeLoad !== 'function') {\n      throw new Error(`Unsupported native addon: ${cacheKey}`)\n    }\n    nativeLoad(nodeModule, cacheKey)\n    const module = this.createModule(cacheKey, parent)\n    module.exports = nodeModule.exports\n    module.loaded = true\n    return module.exports\n  }\n\n  /**\n   * Load a JSON module synchronously and cache the parsed value per runtime.\n   */\n  public loadJson(filename: string, parent?: ExtensionCommonJSModule): unknown {\n    const cacheKey = this.normalizeFilename(filename)\n    const cached = this.runtime.cjsModules.get(cacheKey)\n    if (cached) return cached.exports\n    const source = fs.readFileSync(cacheKey, 'utf8')\n    let value: unknown\n    try {","sourceCodeStart":253,"sourceCodeEnd":289,"githubUrl":"https://github.com/neoclide/coc.nvim/blob/50e974d9692461a69147d5cab146a8d3e439abe4/src/extension/loader.ts#L253-L289","documentation":" thrown by loadNative() when Node's own native addon handler (Module._extensions['.node']) is unavailable, so a .node native addon cannot be dlopen'd. coc.nvim falls back to Node's loader for native addons; if that hook is missing the addon cannot be loaded in the sandbox.","triggerScenarios":"An extension requires a package with a compiled .node binary addon (e.g. native text processing, fsevents) while the runtime exposes no Module._extensions['.node'] (custom/embedded Node builds, hardened runtimes).","commonSituations":"coc.nvim embedded in environments with stripped Module internals (bundled/frozen Node, Electron with patched internals); extensions with native dependencies like sqlite or node-gyp outputs.","solutions":["Use a pure-JavaScript alternative dependency instead of the native addon.","Install the addon at coc.nvim's own Node runtime level rather than inside the sandbox, if possible.","Verify your coc.nvim runs on a standard Node/Vim build where Module._extensions exists.","Report to coc.nvim maintainers if native addon support is expected in your environment."],"exampleFix":"// before (extension package.json)\n\"dependencies\": { \"sqlite3\": \"^5.0.0\" }\n// after\n\"dependencies\": { \"sql.js\": \"^1.8.0\" }  // wasm/pure-JS alternative","handlingStrategy":"fallback","validationCode":"const canLoadNative = typeof (Module._extensions || {})['.node'] === 'function'\nif (!canLoadNative && pkgHasNativeDeps(pkgDir)) throw new Error('native addons unsupported in this runtime')","typeGuard":"function nativeLoadAvailable() { return typeof Module._extensions === 'object' && typeof Module._extensions['.node'] === 'function' }","tryCatchPattern":"try { const addon = require('./binding.node') } catch (e) { if (e.message.startsWith('Unsupported native addon')) { addon = require('./js-fallback') } else { throw e } }","preventionTips":["Prefer pure-JS/wasm dependencies in coc extensions","Test extensions on the exact Node runtime coc.nvim is embedded in","Ship a JS fallback path for native addons"],"tags":["native-addon","module-loader","sandbox","node-internals"],"backgroundTag":"native-addon-load-failed","analyzedSha":"50e974d9692461a69147d5cab146a8d3e439abe4","analyzedAt":"2026-08-31T11:17:23.966Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}