ComposioHQ/composio · critical · KeyringError

dlsym(${name}) failed

Error message

dlsym(${name}) failed

What it means

dlsymCFConstant resolved a CoreFoundation constant symbol by name and got NULL, so the CF constant's storage address could not be obtained. KeyringError kind 'PlatformFailure'.

Source

Thrown at ts/packages/cli-keyring/src/stores/macos-security-ffi.ts:104

    throw new KeyringError({
      kind: 'PlatformFailure',
      cause: new Error(`dlopen(${path}) failed`),
    });
  }
  return handle;
}

/**
 * Resolve an extern const CFTypeRef data symbol: `dlsym` returns the
 * address of the storage slot (i.e. a pointer-to-pointer); we
 * dereference one level via `read.ptr` to get the actual CFTypeRef
 * value stored there. The symbol is stable for the process lifetime,
 * so caching the resolved BigInt is safe.
 */
function dlsymCFConstant(handle: bigint, name: string): bigint {
  const addr = libSystem.symbols.dlsym(handle, cstr(name));
  if (addr === 0n) {
    throw new KeyringError({
      kind: 'PlatformFailure',
      cause: new Error(`dlsym(${name}) failed`),
    });
  }
  // read.ptr wants a number address — the storage address from dlsym
  // is a real heap address (never tagged), so it fits in a number.
  // The VALUE we read back, however, may be a tagged pointer, so we
  // must capture it as BigInt. `read.ptr` on bun returns number;
  // instead we use a small helper that reads 8 bytes into a BigInt.
  return read64(Number(addr));
}

/**
 * Read a 64-bit little-endian value from a process address and
 * return it as BigInt. Used to dereference data-symbol slots (which
 * live at plain heap addresses) without precision loss on the
 * stored value.
 */

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Update the keyring package to a version matching your macOS symbols
  2. Report the failing symbol name to maintainers
  3. Pin deployment/test environments to a supported macOS version
Defensive patterns

Strategy: try-catch

Try / catch

catch (e) { if (e instanceof KeyringError && e.kind === 'PlatformFailure') { /* fall back to non-FFI store */ } else throw e; }

Prevention

When it happens

Trigger: Requesting a CF constant symbol that does not exist in the loaded libSystem/CoreFoundation (renamed/removed symbol, or wrong handle).

Common situations: macOS version differences removing/renaming private symbols; FFI symbol-table drift after OS upgrades.

Related errors


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