Hmbown/CodeWhale · error
The Runtime returned an incomplete provider model catalog.
Error message
The Runtime returned an incomplete provider model catalog.
What it means
On the final page (empty nextCursor) the loader verifies that the number of accumulated entries equals the catalog's declared `total`. A mismatch means the Runtime ended pagination early or late relative to its own count, i.e. it returned a truncated or over-long catalog.
Solutions
- Reload the dialog / retry the load — a transient truncation will resolve
- Restart the Runtime to rule out a stale or buggy backend build
- Compare the provider's actual model count with the `total` field the Runtime returns
- Check proxy/gateway logs for truncated responses on the models endpoint
Example fix
// before: trusting entries even when short
return entries;
// after: surface a clear error when the catalog is short
if (nextCursor === '' && entries.length !== expectedTotal) {
throw new Error('incomplete provider model catalog: got ' + entries.length + ' of ' + expectedTotal);
} Defensive patterns
Strategy: retry
Validate before calling
if (pageDone && entries.length !== expectedTotal) console.warn('catalog short:', entries.length, 'of', expectedTotal); Type guard
const catalogComplete = (entries, total) => Array.isArray(entries) && entries.length === total;
Try / catch
try { models = await loadCatalog(); } catch (e) { if (String(e.message).includes('incomplete')) models = await loadCatalog(); } Prevention
- Retry truncated loads once before reporting
- Verify provider sync completes before exposing the catalog
- Check proxies do not truncate JSON bodies
- Keep Runtime cursor logic and total computation in one place
When it happens
Trigger: The Runtime's models endpoint returns a terminal (empty) nextCursor while entries.length !== expectedTotal — e.g. it served fewer pages than `total` implies, or more entries than total.
Common situations: A Runtime bug in cursor generation that drops the last page; a provider catalog shrunk between the first page and the last; a proxy truncating a response body mid-pagination; partially failed provider sync.
Related errors
- The provider catalog changed; restart loading its models.
- The provider catalog exceeds
- The Runtime returned a cursor beyond its provider model…
- The Runtime returned an invalid provider model page.
- A provider and page loader are required.
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/fa81407308cdbe21.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/runtime_web/app.mjs:691
|| response.total > MAX_PROVIDER_MODELS) {
throw new Error("The Runtime returned an invalid provider model page.");
}
if (expectedTotal !== undefined && expectedTotal !== response.total) {
throw new Error("The provider catalog changed; restart loading its models.");
}
expectedTotal = response.total;
const pageEntries = response.models;
if (entries.length + pageEntries.length > MAX_PROVIDER_MODELS) {
throw new Error(`The provider catalog exceeds ${MAX_PROVIDER_MODELS} models.`);
}
entries.push(...pageEntries);
const nextCursor = typeof response?.nextCursor === "string"
? response.nextCursor.trim()
: "";
if (!nextCursor) {
if (entries.length !== expectedTotal) {
throw new Error("The Runtime returned an incomplete provider model catalog.");
}
return entries;
}
if (pageEntries.length === 0 || seenCursors.has(nextCursor)) {
throw new Error("The Runtime returned a non-progressing model cursor.");
}
if (entries.length >= expectedTotal) {
throw new Error("The Runtime returned a cursor beyond its provider model catalog.");
}
seenCursors.add(nextCursor);
cursor = nextCursor;
}
throw new Error(`The provider catalog exceeds ${MAX_PROVIDER_MODELS} models.`);
}
function startBrowserClient() {
const dom = {
shell: document.querySelector("#app-shell"),View on GitHub (pinned to 73e0f67d83)