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

  1. curl /api/models/names and inspect the payload: is data null, or shaped differently?
  2. Configure at least one model vendor in the backend and retry
  3. 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

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


AI-assisted analysis of danielmiessler/Fabric@338b89cfe9 (2026-08-15). Data as JSON: /api/errors/96c2c63da4f43b25. Report an issue: GitHub.