{"record":{"id":"812478c2d025dbe0","repo":"swc-project/swc","slug":"bindings-not-found-812478","errorCode":null,"errorMessage":"Bindings not found","messagePattern":"Bindings not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/core/src/index.ts","lineNumber":386,"sourceCode":"            return bindings.transformSync(\n                isModule ? stringifyProgram(src) : src,\n                isModule,\n                toBuffer(newOptions)\n            );\n        } else if (fallbackBindings) {\n            if (plugin && !this.fallbackBindingsPluginWarningDisplayed) {\n                console.warn(\n                    `Fallback bindings does not support legacy plugins, it'll be ignored.`\n                );\n                this.fallbackBindingsPluginWarningDisplayed = true;\n            }\n            return fallbackBindings.transformSync(\n                isModule ? JSON.stringify(src) : src,\n                options\n            );\n        }\n\n        throw new Error(\"Bindings not found\");\n    }\n\n    async transformFile(path: string, options?: Options): Promise<Output> {\n        if (!bindings && !!fallbackBindings) {\n            throw new Error(\n                \"Fallback bindings does not support filesystem access.\"\n            );\n        } else if (!bindings) {\n            throw new Error(\"Bindings not found.\");\n        }\n\n        options = options || {};\n\n        if (options?.jsc?.parser) {\n            options.jsc.parser.syntax =\n                options.jsc.parser.syntax ?? \"ecmascript\";\n        }\n","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/packages/core/src/index.ts#L368-L404","documentation":"Final throw of Compiler.transformSync() (this message variant has no trailing period): the native branch and the fallback branch both failed to match, so neither the Node-API binding nor @swc/wasm is available in the process. The @swc/core installation is broken — transformSync() was never even attempted against an engine.","triggerScenarios":"`compiler.transformSync(src, opts)` where require('./binding.js') failed and require('@swc/wasm') failed or resolved to nothing: skipped optional dependencies, pruned or cross-platform node_modules, invalid SWC_BINARY_PATH, bundler-shimmed native require.","commonSituations":"Synchronous SWC paths in build tools (loaders, jest transformers) in CI installed with --omit=optional; Docker images built on a different libc/arch; corrupted node_modules.","solutions":["Clean-reinstall with optionals enabled: `rm -rf node_modules package-lock.json && npm install --include=optional`","Verify the platform binding package for the runtime (`npm ls @swc/core-linux-x64-gnu` or your variant)","Validate or unset SWC_BINARY_PATH","Install @swc/wasm explicitly — transformSync() works on the fallback"],"exampleFix":"# before: compiler.transformSync(src) -> 'Bindings not found'\n\n# after\nrm -rf node_modules package-lock.json && npm install --include=optional\nnode -e \"new (require('@swc/core').Compiler)().transformSync('let x=1')\"","handlingStrategy":"validation","validationCode":"const { Compiler } = require('@swc/core');\nfunction assertSwcBindingsAvailable() {\n  try {\n    new Compiler().transformSync('');\n  } catch (e) {\n    if (e instanceof Error && /Bindings not found/.test(e.message)) {\n      throw new Error('SWC install broken: reinstall with optional platform packages or add @swc/wasm.');\n    }\n    throw e;\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  const out = compiler.transformSync(src, opts);\n} catch (e) {\n  if (e instanceof Error && /Bindings not found/.test(e.message)) {\n    throw new Error('SWC native bindings missing — clean reinstall required (do not skip optional deps).');\n  }\n  throw e;\n}","preventionTips":["Probe transformSync with empty input at process start in loaders/jest transformers","Assert the platform-specific binding package resolves in CI after every install","Install @swc/wasm explicitly so synchronous transforms keep working even if native loading fails"],"tags":["swc","native-bindings","transformsync","install"],"backgroundTag":"native-bindings-not-found","analyzedSha":"5176682b65416c6b5de6b47379ae1588ea3ecb3f","analyzedAt":"2026-08-17T16:16:52.067Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}