ComposioHQ/composio · error · Error

Bundled FFI library was not found for .

Error message

Bundled FFI library ${execution.library.bundledBinary} was not found for ${context.platform}.

What it means

An FFI-based local tool declared a bundled native library; resolution for the current platform found neither the bundled library nor a fallbackCommand path. Unlike the command variant (240/242), there is no executable fallback, so FFI loading cannot proceed.

Solutions

  1. Install the packaged CLI build matching your OS and arch
  2. Reinstall the CLI if native assets are missing
  3. As a tool author, set fallbackCommand to a system library path when bundling is unavailable
Defensive patterns

Strategy: fallback

Validate before calling

// Verify platform assets exist before calling FFI tools:
if (!existsSync(join(cliBinDir, `${libName}.${extFor(platform)}`))) skip();

Try / catch

try { ... } catch (e) { if (e.message.includes('Bundled FFI library')) fallbackToCommandTool(); }

Prevention

When it happens

Trigger: Running an FFI local tool on a platform without a bundled .so/.dylib/.dll; dev installs lacking the native library; partial CLI distribution.

Common situations: Platform-specific native libs missing from a CLI download; running from source; OS/arch mismatch (arm64 vs x64 builds).

Related errors


AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28). Data as JSON: /api/errors/16cb74717eb32edf. Report an issue: GitHub.

Appendix: source

Thrown at ts/packages/cli-local-tools/src/runtime.ts:238

  bool: 'bool',
  ptr: 'ptr',
  cstring: 'cstring',
  void: 'void',
};

const isBun = typeof (globalThis as { Bun?: unknown }).Bun !== 'undefined';

const resolveFfiLibraryPath = async (
  execution: LocalFfiExecution,
  context: LocalExecutionContext
): Promise<string> => {
  if (typeof execution.library === 'string') return execution.library;
  const resolved = await resolveBundledBinary(context.toolkit, execution.library, {
    currentPlatform: context.platform,
  });
  if (resolved?.exists) return resolved.path;
  if (execution.library.fallbackCommand) return execution.library.fallbackCommand;
  throw new Error(
    `Bundled FFI library ${execution.library.bundledBinary} was not found for ${context.platform}.`
  );
};

const runLocalFfiTool = async (
  execution: LocalFfiExecution,
  input: Record<string, unknown>,
  context: LocalExecutionContext
): Promise<LocalExecutionResult> => {
  if (!isBun) {
    throw new Error(
      'Local FFI execution requires the Bun runtime used by the packaged Composio CLI.'
    );
  }

  const { dlopen, FFIType } = (await import('bun:ffi')) as typeof import('bun:ffi');
  const libraryPath = await resolveFfiLibraryPath(execution, context);
  const bindings = Object.fromEntries(

View on GitHub (pinned to 64b1b85502)