danielmiessler/Fabric · error · Error
Invalid response format: missing vendors data
Error message
Invalid response format: missing vendors data
What it means
modelsApi.getAvailable() expects { vendors: Record<string, string[]> } from GET /api/models/names and throws when response.data.vendors is missing. The endpoint exists (HTTP succeeded) but the payload shape does not match, so the client cannot enumerate vendor models.
Source
Thrown at web/src/lib/api/models.ts:10
import { api } from './base';
import type { VendorModel, ModelsResponse } from '$lib/interfaces/model-interface';
export const modelsApi = {
async getAvailable(): Promise<VendorModel[]> {
try {
const response = await api.fetch<ModelsResponse>('/models/names');
if (!response.data?.vendors) {
throw new Error('Invalid response format: missing vendors data');
}
// The server sends null for the model list of a vendor that it can find
// no models for, because an empty slice in Go becomes null in JSON.
// Ollama does this when it is in the configuration but serves no models.
// Skip such a vendor: one of them must not hide the models of the others.
return Object.entries(response.data.vendors).flatMap(([vendor, models]) =>
Array.isArray(models)
? models.map(model => ({
name: model,
vendor
}))
: []
);
} catch (error) {
console.error("Failed to fetch models:", error);
throw error;
}View on GitHub (pinned to 338b89cfe9)
Solutions
- curl /api/models/names and inspect the payload: is data null, or shaped differently?
- Configure at least one model vendor in the backend and retry
- If schema drift, align frontend/backend versions or tolerate a missing vendors field as an empty list
Example fix
// before
if (!response.data?.vendors) {
throw new Error('Invalid response format: missing vendors data');
}
// after
const vendors = response.data?.vendors;
if (!vendors) {
if (response.error) throw new Error(response.error);
return []; // no vendors configured, not a hard failure
} Defensive patterns
Strategy: type-guard
Type guard
function isVendorsPayload(d: unknown): d is { vendors: Record<string, string[]> } {
return typeof d === 'object' && d !== null
&& typeof (d as any).vendors === 'object' && (d as any).vendors !== null;
} Try / catch
try { models = await modelsApi.getAvailable(); }
catch (e) {
if (e instanceof Error && e.message.includes('missing vendors')) models = []; // show 'no vendors configured'
else throw e;
} Prevention
- Validate response shape with a guard before trusting it
- Return [] for zero vendors instead of throwing so the UI can render an empty state
- Pin frontend and backend versions together during upgrades
When it happens
Trigger: Backend /api/models/names returning { data: null } because no vendors are configured, returning { error } consumed as null data, or a backend version whose response schema predates the vendors field.
Common situations: Fresh install with no model vendors configured in Fabric; Ollama/registry endpoints down so the backend reports zero vendors; frontend newer than the backend (schema drift after upgrade).
Related errors
- HTTP error! status: ${response.status}
- response.error
- HTTP_ERROR
- ${fileName} contains no machine-readable text. OCR is necess
- ${fileName}: the conversion returned no text.
AI-assisted analysis of danielmiessler/Fabric@338b89cfe9 (2026-08-15).
Data as JSON: /api/errors/96c2c63da4f43b25.
Report an issue: GitHub.