abhigyanpatwari/GitNexus · warning
Could not read the LadybugDB index catalog (CALL SHOW_INDEXE
Error message
Could not read the LadybugDB index catalog (CALL SHOW_INDEXES()); extension-gated DML checks must assume an index may be present.
What it means
readIndexCatalogRows() could not execute `CALL SHOW_INDEXES() RETURN *` (missing extension in the LadybugDB build, connection fault). It returns undefined instead of rows, and the surrounding IndexCatalogSnapshot model distinguishes 'could not prove anything' from 'proved no index': extension-gated DML checks must then assume an index may be present (conservative).
Source
Thrown at gitnexus/src/core/lbug/lbug-adapter.ts:3517
*
* `undefined` means "could not prove anything" and every caller must treat it
* as fail-closed (assume an index may be present), never as "no indexes". All
* three readers below honour that, `ftsIndexExistsInCatalog` included since
* #2841 review H3. To hand ONE read to several gates, use
* {@link readIndexCatalogSnapshot} — passing this `undefined` on cannot be
* distinguished from passing nothing at all.
*/
export const readIndexCatalogRows = async (): Promise<IndexCatalogRow[] | undefined> => {
const targetConn = conn;
if (!targetConn) {
throw new Error('LadybugDB not initialized. Call initLbug first.');
}
try {
return (await withConnLock(async () =>
readQueryRows(await targetConn.query('CALL SHOW_INDEXES() RETURN *')),
)) as IndexCatalogRow[];
} catch (err) {
logger.warn(
{ err },
'Could not read the LadybugDB index catalog (CALL SHOW_INDEXES()); ' +
'extension-gated DML checks must assume an index may be present.',
);
return undefined;
}
};
/**
* The failed half of an {@link IndexCatalogSnapshot}: the caller DID read the
* catalog and could not prove anything.
*
* It exists because `undefined` was overloaded (#2841 review §5.A). The gates
* below took `indexRows?: IndexCatalogRow[]`, so "my read failed" and "I passed
* you nothing" were the SAME value, and each gate's `?? (await
* readIndexCatalogRows())` silently re-read the catalog — turning the one shared
* read the call site documents into three round-trips and three identical
* warnings on the failure path, with the two gates free to decide from DIFFERENTView on GitHub (pinned to 0d1aed942f)
Solutions
- Update gitnexus (npm install gitnexus@latest) so the vendored LadybugDB supports SHOW_INDEXES.
- Handle the undefined return conservatively — do not treat it as 'no indexes' when deciding on extension-gated DML.
- Re-run the operation; transient connection faults resolve on retry.
- Check the logged err for the exact engine message if it persists.
Example fix
// before: assuming rows means no index const rows = await readIndexCatalogRows(); if (rows.length === 0) skipIndexAwarePath(); // after: undefined means unknown — stay conservative const rows = await readIndexCatalogRows(); if (rows === undefined) assumeIndexMayExist(); else if (rows.length === 0) skipIndexAwarePath();
Defensive patterns
Strategy: type-guard
Type guard
type Catalog = IndexCatalogRow[] | undefined; // undefined === 'unknown', NOT 'no indexes'
function catalogProves(rows: Catalog): rows is IndexCatalogRow[] {
return Array.isArray(rows);
} Try / catch
const rows = await readIndexCatalogRows(); // never throws; returns undefined on failure
if (!catalogProves(rows)) {
takeConservativePath(); // assume an index may be present
} else {
decideFrom(rows);
} Prevention
- Model the snapshot as 'proved / disproved / unknown' — never collapse unknown into empty.
- Keep the gitnexus package updated so SHOW_INDEXES support tracks the engine.
- Log the returned err context when unknown recurs; it distinguishes extension-missing from connection faults.
When it happens
Trigger: Any code path calling readIndexCatalogRows() — index-aware DELETE optimization decisions — where the SHOW_INDEXES catalog call throws: older LadybugDB without the extension, a broken connection, or a read-only/busy catalog moment. The function requires initLbug first and throws separately if conn is unset.
Common situations: LadybugDB version drift after upgrading the package but not the vendored native build; exotic builds where catalog extensions are compiled out; concurrent access corner cases during startup.
Related errors
- LadybugDB not initialized for repo "${repoId}". Call initLbu
- withRetry: maxAttempts must be >= 1, got ${opts.maxAttempts}
- [understand-quickly] expected id of the form "owner/repo", g
- [embed] Failed to delete stale embedding rows — aborting to
- Invalid DuckDB extension name: ${extensionName}
AI-assisted analysis of abhigyanpatwari/GitNexus@0d1aed942f (2026-08-20).
Data as JSON: /api/errors/def98ee34fc70467.
Report an issue: GitHub.