{"record":{"id":"a07120eafd76f78b","repo":"biomejs/biome","slug":"biomejs-runtime-plugin-is-intended-to-be-used-in-biome-js","errorCode":null,"errorMessage":"@biomejs/runtime/plugin is intended to be used in Biome JS plugins, did you mean `@biomejs/js-api`?","messagePattern":"@biomejs/runtime/plugin is intended to be used in Biome JS plugins, did you mean `@biomejs/js-api`\\?","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@biomejs/runtime/plugin.js","lineNumber":1,"sourceCode":"throw new Error(\n\t\"@biomejs/runtime/plugin is intended to be used in Biome JS plugins, did you mean `@biomejs/js-api`?\",\n);\n","sourceCodeStart":1,"sourceCodeEnd":4,"githubUrl":"https://github.com/biomejs/biome/blob/3835945f0638c88162351318b7bc8b64c5f2fba7/packages/@biomejs/runtime/plugin.js#L1-L4","documentation":"This error is thrown by the @biomejs/runtime package's /plugin entry point to stop developers who imported the wrong package. @biomejs/runtime/plugin only exists to be loaded by the Biome plugin host runtime inside Biome JS plugins; application code that wants to control Biome programmatically must use @biomejs/js-api instead. The throw fires immediately at module load so the mistake fails fast.","triggerScenarios":"Importing or requiring '@biomejs/runtime/plugin' (via import, require, or a bundler resolving it from a plugin entry) from code that is not being executed as a Biome JS plugin by the Biome plugin runtime.","commonSituations":"A developer writing a tool that should open/analyze files with Biome picks the wrong package name from autocomplete; a package rename or documentation confusion between 'runtime' (plugin-side runtime shipped with Biome plugins) and 'js-api' (embeddable API) causes a wrong import; copying an import from a Biome plugin repo into an ordinary Node script.","solutions":["Install and import @biomejs/js-api instead: `npm install @biomejs/js-api` and use `import * as biome from \"@biomejs/js-api\"` for programmatic use.","If you ARE writing a Biome JS plugin, do not import the runtime entry manually; declare the plugin (e.g. via its manifest/entry) and let Biome's plugin host provide the runtime.","Check the import specifier for typos or stale paths after upgrading Biome packages."],"exampleFix":"// before\nimport { Runtime } from \"@biomejs/runtime/plugin\";\n// after\nimport * as biome from \"@biomejs/js-api\";","handlingStrategy":"try-catch","validationCode":"// Guard: detect the wrong-package import before use\nfunction isJsApiAvailable(mod: any): boolean {\n  return typeof mod === \"object\" && mod !== null && !/runtime\\/plugin/.test(import.meta?.url ?? \"\");\n}\nif (!isJsApiAvailable(biomeModule)) throw new Error(\"Use @biomejs/js-api for programmatic Biome access\");","typeGuard":"function isJsApiModule(mod: unknown): mod is typeof import(\"@biomejs/js-api\") {\n  return typeof mod === \"object\" && mod !== null && \"workspace\" in (mod as object);\n}","tryCatchPattern":"try {\n  await import(\"@biomejs/runtime/plugin\");\n} catch (e) {\n  if (e instanceof Error && e.message.includes(\"@biomejs/js-api\")) {\n    // fall back to the correct package\n    const biome = await import(\"@biomejs/js-api\");\n  } else { throw e; }\n}","preventionTips":["Import @biomejs/js-api for programmatic Biome control; reserve @biomejs/runtime for inside Biome JS plugins.","Let the plugin host load the runtime entry; never import it directly from application code.","Add a lint/import rule or dependency check that flags '@biomejs/runtime' imports outside plugin packages."],"tags":["javascript","imports","wrong-package","biome"],"backgroundTag":"deprecated-api-usage","analyzedSha":"3835945f0638c88162351318b7bc8b64c5f2fba7","analyzedAt":"2026-09-13T15:11:16.919Z","contentChangedAt":"2026-09-13T15:11:16.919Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}