Skip to content

lbug npm package: All extensions fail to load with ABI mismatch (undefined symbol) #128

@arimxyer

Description

@arimxyer

Summary

The lbug npm package cannot load any extensions due to ABI mismatch between the npm package and the extension binaries served by the extension server.

Environment

  • Package: lbug (npm)
  • Versions tested: 0.12.0, 0.12.2, 0.13.0, 0.13.1-dev.18, 0.13.2-dev.4
  • Platform: Linux x64 (tested in Docker with Bun 1.3.5, and locally with Node.js)
  • Extension server: Default (extensions download to ~/.lbug/extension/dev/linux_amd64/)

Steps to Reproduce

const lbug = require('lbug');

async function test() {
  const db = new lbug.Database('./test.db');
  await db.init();
  const conn = new lbug.Connection(db);
  
  // Check pre-loaded extensions
  const loaded = await conn.query('CALL show_loaded_extensions() RETURN *');
  console.log('Pre-loaded:', loaded.getAllSync()); // Returns []
  
  // Try to load extension
  await conn.query('INSTALL vector');  // OK
  await conn.query('LOAD vector');     // FAILS
}
test();

Expected Behavior

Per the documentation at https://docs.ladybugdb.com/extensions:

"If you've upgraded to the latest version v0.11.3, Ladybug has pre-installed and pre-loaded four commonly used extensions (algo, fts, json, vector) for you. You do not need to manually INSTALL or LOAD these extensions."

Extensions should either be pre-loaded, or INSTALL + LOAD should work.

Actual Behavior

  1. show_loaded_extensions() returns empty array - extensions are NOT pre-loaded
  2. LOAD vector (without INSTALL) fails: "Extension has not been installed"
  3. INSTALL vector succeeds (downloads file)
  4. LOAD vector (after INSTALL) fails with ABI mismatch:
IO exception: Failed to load library: /root/.lbug/extension/dev/linux_amd64/vector/libvector.lbug_extension 
which is needed by extension: vector.
Error: undefined symbol: _ZTIN4lbug7catalog12IndexAuxInfoE

All four extensions fail identically: vector, fts, json, algo

Analysis

The error undefined symbol: _ZTIN4lbug7catalog12IndexAuxInfoE (demangled: typeinfo for lbug::catalog::IndexAuxInfo) indicates the extension binaries were compiled against a different version of the core library than what's shipped in the npm package.

Notable observations:

  • Extensions download to /dev/ path even for non-dev npm versions
  • The upstream kuzu npm package (v0.11.3) has these extensions statically linked and works perfectly
  • The lbug npm package starts at v0.12.0 (no 0.11.x exists), but docs reference v0.11.3

Comparison with Kuzu

const kuzu = require('kuzu'); // v0.11.3

// show_loaded_extensions() returns:
// ALGO, FTS, JSON, VECTOR - all with source "STATIC LINK"

// Vector index creation works immediately, no INSTALL/LOAD needed

Suggested Fix

Either:

  1. Statically link extensions into the npm package (like upstream Kuzu does)
  2. Ensure extension server binaries match the exact ABI of each npm release
  3. Update documentation to reflect actual npm package behavior

Workaround

Use upstream kuzu npm package instead of lbug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions