different-ai/openwork · error
Provider details could not be parsed.
Error message
Provider details could not be parsed.
What it means
After locating payload.provider, the code runs it through asCatalogProviderDetail; if that validator returns null the provider object does not match the expected detail schema and this error is thrown. It ensures the editor screen never renders an invalid provider detail object.
Source
Thrown at ee/apps/den-web/app/(den)/dashboard/_components/llm-provider-data.tsx:493
export async function requestLlmProviderCatalogDetail(orgId: string, providerId: string) {
const { response, payload } = await requestJson(
`/v1/llm-provider-catalog/${encodeURIComponent(providerId)}`,
{ method: "GET" },
20000,
);
if (!response.ok) {
throw new Error(getErrorMessage(payload, `Failed to load provider details (${response.status}).`));
}
if (!isRecord(payload) || !payload.provider) {
throw new Error("Provider details were missing from the response.");
}
const detail = asCatalogProviderDetail(payload.provider);
if (!detail) {
throw new Error("Provider details could not be parsed.");
}
return detail;
}
export function useOrgLlmProviders(
orgId: string | null,
options: { scope?: "usable" | "manageable" } = {},
) {
const [llmProviders, setLlmProviders] = useState<DenLlmProvider[]>([]);
const [busy, setBusy] = useState(false);
const [error, setError] = useState<string | null>(null);
const scope = options.scope ?? "manageable";
async function loadProviders() {
if (!orgId) {
setLlmProviders([]);
setError("Organization not found.");View on GitHub (pinned to 2b7df46e8a)
Solutions
- Log payload.provider and diff its keys against what asCatalogProviderDetail requires.
- Extend asCatalogProviderDetail to accept the new/optional fields.
- Fix the server-side normalization so catalog details are always complete before responding.
- If caused by a specific provider, exclude or repair that provider's upstream data.
Example fix
// before
function asCatalogProviderDetail(v: unknown) {
if (!isRecord(v) || typeof v.models !== "object") return null;
...
}
// after (tolerate missing models as empty list)
function asCatalogProviderDetail(v: unknown) {
if (!isRecord(v)) return null;
const models = Array.isArray(v.models) ? v.models : [];
...
} Defensive patterns
Strategy: type-guard
Validate before calling
function validateProviderDetailShape(v: unknown): string[] {
const problems: string[] = [];
if (typeof v !== "object" || v === null) return ["not an object"];
const r = v as Record<string, unknown>;
if (typeof r.id !== "string") problems.push("id missing");
if (typeof r.name !== "string") problems.push("name missing");
if (!Array.isArray(r.models)) problems.push("models not an array");
return problems;
} Type guard
function isCatalogProviderDetail(v: unknown): v is CatalogProviderDetail {
if (typeof v !== "object" || v === null) return false;
const r = v as Record<string, unknown>;
return typeof r.id === "string" && typeof r.name === "string" && Array.isArray(r.models);
} Try / catch
try {
const detail = await requestLlmProviderCatalogDetail(providerId);
} catch (err) {
if (err instanceof Error && err.message === "Provider details could not be parsed.") {
console.error("Provider detail failed schema validation — likely upstream models.dev change");
} else throw err;
} Prevention
- Normalize provider details server-side to a fixed schema before responding.
- Make asCatalogProviderDetail tolerant of optional new fields with defaults.
- Add fixtures for every catalog provider through the validator in CI.
- Watch upstream (models.dev) changelogs for metadata shape changes.
When it happens
Trigger: payload.provider exists but fails asCatalogProviderDetail validation — missing required fields (e.g. models list, pricing fields), wrong field types, or a newly added catalog provider shape the validator does not recognize.
Common situations: models.dev upstream added/renamed provider metadata fields and the server passes them through; a new provider entry in the catalog doesn't satisfy the frontend's expected schema; partial data cached server-side.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Provider details were missing from the response.
- Library response was incomplete.
- Endpoint test returned an unexpected response.
- Inference settings response was incomplete.
- Failed to load the provider catalog (${response.status}).
AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01).
Data as JSON: /api/errors/ef2fde78306bbf1c.
Report an issue: GitHub.