{"record":{"id":"9b7a9d0b8bce0f66","repo":"neoclide/coc.nvim","slug":"process-name-is-not-allowed-in-extension-sand","errorCode":null,"errorMessage":"process.${name}() is not allowed in extension sandbox","messagePattern":"process\\.(.+?)\\(\\) is not allowed in extension sandbox","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/extension/loader.ts","lineNumber":120,"sourceCode":"  'exit',\n  'kill',\n]\n\nexport const consoleLogger: ILogger = {\n  category: '',\n  log: console.log.bind(console),\n  debug: console.debug.bind(console),\n  error: console.error.bind(console),\n  warn: console.warn.bind(console),\n  info: console.info.bind(console),\n  trace: console.log.bind(console),\n  fatal: console.error.bind(console),\n  mark: console.log.bind(console),\n}\n\nfunction removedGlobalStub(name: string) {\n  return () => {\n    throw new Error(`process.${name}() is not allowed in extension sandbox`)\n  }\n}\n\n/**\n * Process facade exposed to extensions as the `process` global and returned\n * by `require('process')` / `require('node:process')`.\n */\nexport function createProcessFacade(): NodeJS.Process {\n  const facade: any = new (process as any).constructor()\n  for (let key of Reflect.ownKeys(process)) {\n    if (typeof key === 'string' && key.startsWith('_')) continue\n    facade[key] = process[key]\n  }\n  REMOVED_GLOBALS.forEach(name => {\n    facade[name] = removedGlobalStub(name)\n  })\n  facade['chdir'] = () => {}\n  facade['umask'] = (mask?: number) => {","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/neoclide/coc.nvim/blob/50e974d9692461a69147d5cab146a8d3e439abe4/src/extension/loader.ts#L102-L138","documentation":" thrown by stubs installed in the extension sandbox for process methods that were removed for security (REMOVED_GLOBALS, e.g. exit, abort, kill). Extensions run isolated; calling a destructive process API raises instead of affecting the host coc.nvim process.","triggerScenarios":"An extension calls process.exit(), process.abort(), process.kill(), etc., or a transitive dependency (e.g. old exit-using libraries) invokes them at runtime inside the sandboxed loader.","commonSituations":"Extensions ported from plain Node.js code that assumes it can terminate the process; debug code calling process.exit in a command handler; dependency like graceful-fs-era code paths.","solutions":["Remove/replace the process.<name>() call in the extension code.","Use the extension's proper lifecycle (deactivate/dispose) instead of process.exit.","Wrap legacy dependencies so their exit paths don't run, or upgrade the dependency.","Report the extension bug to its maintainer if it's third-party."],"exampleFix":"// before (in extension)\nif (!ready) process.exit(1)\n// after\nif (!ready) throw new Error('extension not ready')  // or return early / dispose","handlingStrategy":"try-catch","validationCode":"// static check of extension source before load:\nif (/process\\.(exit|abort|kill)\\s*\\(/.test(extSource)) throw new Error('extension uses forbidden process API')","typeGuard":null,"tryCatchPattern":"try { activateExtension(ext) } catch (e) { if (e.message.includes('is not allowed in extension sandbox')) { disableExtension(ext, e.message) } else { throw e } }","preventionTips":["Never call process.exit/abort/kill in coc extension code","Use extension deactivate/dispose lifecycle for cleanup","Audit dependencies for process.exit side effects"],"tags":["sandbox","security","process-global","extension-runtime"],"backgroundTag":"process-exit-not-allowed-in-sandbox","analyzedSha":"50e974d9692461a69147d5cab146a8d3e439abe4","analyzedAt":"2026-08-31T11:17:23.966Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}