jackwener/OpenCLI · warning

TS transpilation setup failed: ${getErrorMessage(err)}

Error message

TS transpilation setup failed: ${getErrorMessage(err)}

What it means

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.

Source

Thrown at src/plugin.ts:1552

      const jsPath = path.join(pluginDir, jsFile);

      // Skip if .js already exists (plugin may ship pre-compiled)
      if (fs.existsSync(jsPath)) continue;

      try {
        execFileSync(esbuildBin, [tsFile, `--outfile=${jsFile}`, '--format=esm', '--platform=node'], {
          cwd: pluginDir,
          encoding: 'utf-8',
          stdio: ['pipe', 'pipe', 'pipe'],
          ...(isWindows && { shell: true }),
        });
        log.debug(`Transpiled plugin file: ${tsFile} → ${jsFile}`);
      } catch (err) {
        log.warn(`Failed to transpile ${tsFile}: ${getErrorMessage(err)}`);
      }
    }
  } catch (err) {
    log.warn(`TS transpilation setup failed: ${getErrorMessage(err)}`);
  }
}

export {
  resolveHostOpencliRoot as _resolveHostOpencliRoot,
  resolveEsbuildBin as _resolveEsbuildBin,
  getCommitHash as _getCommitHash,
  installDependencies as _installDependencies,
  parseSource as _parseSource,
  postInstallMonorepoLifecycle as _postInstallMonorepoLifecycle,
  readLockFile as _readLockFile,
  readLockFileWithWriter as _readLockFileWithWriter,
  updateAllPlugins as _updateAllPlugins,
  validatePluginStructure as _validatePluginStructure,
  writeLockFile as _writeLockFile,
  writeLockFileWithFs as _writeLockFileWithFs,
  isSymlinkSync as _isSymlinkSync,
  getMonoreposDir as _getMonoreposDir,

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Read the embedded getErrorMessage(err) detail in the warning to identify the root cause
  2. Verify esbuild is installed and its binary is executable; reinstall esbuild if the binary is missing
  3. Check file permissions on the plugin directory and .ts files
  4. Test the resolvers directly via the exported hooks _resolveHostOpencliRoot and _resolveEsbuildBin to see which step fails
  5. Reinstall or rebuild the package so bundled plugin assets are present

Example fix

// before: transpilation silently skipped, plugin .ts not loaded
// $ opencli plugin load
// warn: TS transpilation setup failed: Cannot find esbuild binary
// after
npm install -g esbuild
chmod +x $(command -v esbuild)
Defensive patterns

Strategy: fallback

Validate before calling

try { execFileSync(esbuildBin, ['--version']); } catch { console.error('esbuild unavailable'); }

Try / catch

try { await setupTsTranspile(); } catch (err) { log.warn(`skipped: ${getErrorMessage(err)}`); }

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/66b73bdeb6359409. Report an issue: GitHub.