{"record":{"id":"16cb74717eb32edf","repo":"ComposioHQ/composio","slug":"bundled-ffi-library-execution-library-bundledbin","errorCode":null,"errorMessage":"Bundled FFI library ${execution.library.bundledBinary} was not found for ${context.platform}.","messagePattern":"Bundled FFI library (.+?) was not found for (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ts/packages/cli-local-tools/src/runtime.ts","lineNumber":238,"sourceCode":"  bool: 'bool',\n  ptr: 'ptr',\n  cstring: 'cstring',\n  void: 'void',\n};\n\nconst isBun = typeof (globalThis as { Bun?: unknown }).Bun !== 'undefined';\n\nconst resolveFfiLibraryPath = async (\n  execution: LocalFfiExecution,\n  context: LocalExecutionContext\n): Promise<string> => {\n  if (typeof execution.library === 'string') return execution.library;\n  const resolved = await resolveBundledBinary(context.toolkit, execution.library, {\n    currentPlatform: context.platform,\n  });\n  if (resolved?.exists) return resolved.path;\n  if (execution.library.fallbackCommand) return execution.library.fallbackCommand;\n  throw new Error(\n    `Bundled FFI library ${execution.library.bundledBinary} was not found for ${context.platform}.`\n  );\n};\n\nconst runLocalFfiTool = async (\n  execution: LocalFfiExecution,\n  input: Record<string, unknown>,\n  context: LocalExecutionContext\n): Promise<LocalExecutionResult> => {\n  if (!isBun) {\n    throw new Error(\n      'Local FFI execution requires the Bun runtime used by the packaged Composio CLI.'\n    );\n  }\n\n  const { dlopen, FFIType } = (await import('bun:ffi')) as typeof import('bun:ffi');\n  const libraryPath = await resolveFfiLibraryPath(execution, context);\n  const bindings = Object.fromEntries(","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/cli-local-tools/src/runtime.ts#L220-L256","documentation":"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.","triggerScenarios":"Running an FFI local tool on a platform without a bundled .so/.dylib/.dll; dev installs lacking the native library; partial CLI distribution.","commonSituations":"Platform-specific native libs missing from a CLI download; running from source; OS/arch mismatch (arm64 vs x64 builds).","solutions":["Install the packaged CLI build matching your OS and arch","Reinstall the CLI if native assets are missing","As a tool author, set fallbackCommand to a system library path when bundling is unavailable"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// Verify platform assets exist before calling FFI tools:\nif (!existsSync(join(cliBinDir, `${libName}.${extFor(platform)}`))) skip();","typeGuard":null,"tryCatchPattern":"try { ... } catch (e) { if (e.message.includes('Bundled FFI library')) fallbackToCommandTool(); }","preventionTips":["Match CLI download to your OS/arch","Provide fallbackCommand when authoring FFI tools"],"tags":["ffi","native-library","local-tools","packaging"],"backgroundTag":"native-library-not-found","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}