Skip to content

Commit 81c387a

Browse files
committed
fix(rebuild): per-item vi.add try/catch to preserve soft-fail
Restores the pre-batch soft-fail behavior — a single failing vi.add() no longer aborts the entire rebuild batch. Failures are logged and counted toward fail, just like dimension mismatches above.
1 parent 5613ce7 commit 81c387a

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

src/functions/search.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,17 @@ export async function vectorIndexAddBatchGuarded(
148148
fail++
149149
continue
150150
}
151-
vi.add(item.id, item.sessionId, embedding)
152-
ok++
151+
try {
152+
vi.add(item.id, item.sessionId, embedding)
153+
ok++
154+
} catch (err) {
155+
logger.warn("vector-index add batch: index write failed — skipping item", {
156+
kind: item.context.kind,
157+
id: item.context.logId,
158+
error: err instanceof Error ? err.message : String(err),
159+
})
160+
fail++
161+
}
153162
}
154163
return { ok, fail }
155164
}

0 commit comments

Comments
 (0)