{"record":{"id":"66b73bdeb6359409","repo":"jackwener/OpenCLI","slug":"ts-transpilation-setup-failed-geterrormessage-e","errorCode":null,"errorMessage":"TS transpilation setup failed: ${getErrorMessage(err)}","messagePattern":"TS transpilation setup failed: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/plugin.ts","lineNumber":1552,"sourceCode":"      const jsPath = path.join(pluginDir, jsFile);\n\n      // Skip if .js already exists (plugin may ship pre-compiled)\n      if (fs.existsSync(jsPath)) continue;\n\n      try {\n        execFileSync(esbuildBin, [tsFile, `--outfile=${jsFile}`, '--format=esm', '--platform=node'], {\n          cwd: pluginDir,\n          encoding: 'utf-8',\n          stdio: ['pipe', 'pipe', 'pipe'],\n          ...(isWindows && { shell: true }),\n        });\n        log.debug(`Transpiled plugin file: ${tsFile} → ${jsFile}`);\n      } catch (err) {\n        log.warn(`Failed to transpile ${tsFile}: ${getErrorMessage(err)}`);\n      }\n    }\n  } catch (err) {\n    log.warn(`TS transpilation setup failed: ${getErrorMessage(err)}`);\n  }\n}\n\nexport {\n  resolveHostOpencliRoot as _resolveHostOpencliRoot,\n  resolveEsbuildBin as _resolveEsbuildBin,\n  getCommitHash as _getCommitHash,\n  installDependencies as _installDependencies,\n  parseSource as _parseSource,\n  postInstallMonorepoLifecycle as _postInstallMonorepoLifecycle,\n  readLockFile as _readLockFile,\n  readLockFileWithWriter as _readLockFileWithWriter,\n  updateAllPlugins as _updateAllPlugins,\n  validatePluginStructure as _validatePluginStructure,\n  writeLockFile as _writeLockFile,\n  writeLockFileWithFs as _writeLockFileWithFs,\n  isSymlinkSync as _isSymlinkSync,\n  getMonoreposDir as _getMonoreposDir,","sourceCodeStart":1534,"sourceCodeEnd":1570,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/src/plugin.ts#L1534-L1570","documentation":"The plugin's TypeScript transpilation setup step failed. The library transpiles .ts plugin files to .js using esbuild at load time; if any part of that setup (resolving the esbuild binary, scanning files, transpiling) throws, it logs a warning with the underlying message and continues instead of crashing the host.","triggerScenarios":"Any exception thrown while setting up TS transpilation for plugin files: esbuild binary not found or not executable, a .ts plugin file unreadable, or an unexpected error in the outer setup routine (distinct from per-file transpile failures, which log separately).","commonSituations":"esbuild not installed or installed at an unexpected path, PATH/permission issues making the binary non-executable, a corrupted or malformed plugin .ts file breaking the whole setup, running from a packaged/bundled install where esbuild's binary is missing.","solutions":["Read the embedded getErrorMessage(err) detail in the warning to identify the root cause","Verify esbuild is installed and its binary is executable; reinstall esbuild if the binary is missing","Check file permissions on the plugin directory and .ts files","Test the resolvers directly via the exported hooks _resolveHostOpencliRoot and _resolveEsbuildBin to see which step fails","Reinstall or rebuild the package so bundled plugin assets are present"],"exampleFix":"// before: transpilation silently skipped, plugin .ts not loaded\n// $ opencli plugin load\n// warn: TS transpilation setup failed: Cannot find esbuild binary\n// after\nnpm install -g esbuild\nchmod +x $(command -v esbuild)","handlingStrategy":"fallback","validationCode":"try { execFileSync(esbuildBin, ['--version']); } catch { console.error('esbuild unavailable'); }","typeGuard":null,"tryCatchPattern":"try { await setupTsTranspile(); } catch (err) { log.warn(`skipped: ${getErrorMessage(err)}`); }","preventionTips":["Install esbuild with the host","Verify binary permissions post-deploy","Check _resolveEsbuildBin in packaged builds"],"tags":["transpilation","typescript","esbuild","plugin-loading"],"backgroundTag":"esbuild-binary-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}