different-ai/openwork · error · Error
Failed to load MCP presets (${response.status}).
Error message
Failed to load MCP presets (${response.status}). What it means
Thrown by useMcpConnectionPresets when GET /v1/mcp-connections/presets returns a non-ok status (15000ms timeout). getRequestError reports the server's error message or the fallback 'Failed to load MCP presets (<status>)'. The presets query then errors and consumers fall back to the default empty array (data ?? []).
Source
Thrown at ee/apps/den-web/app/(den)/dashboard/_components/mcp-connections-data.tsx:599
}));
}
export function useMcpConnections(scope: ExternalMcpConnectionScope = "manageable") {
const { orgId } = useOrgDashboard();
return useQuery({
enabled: Boolean(orgId),
queryKey: mcpConnectionQueryKeys.list(orgId, scope),
queryFn: () => fetchConnections(scope, requireOrgId(orgId)),
});
}
export function useMcpConnectionPresets() {
return useQuery({
queryKey: mcpConnectionQueryKeys.presets(),
queryFn: async (): Promise<ExternalMcpPreset[]> => {
const { response, payload } = await requestJson("/v1/mcp-connections/presets", {}, 15000);
if (!response.ok) {
throw getRequestError(payload, response, `Failed to load MCP presets (${response.status}).`);
}
const record = payload as { presets?: ExternalMcpPreset[] };
return record.presets ?? [];
},
});
}
export type McpConnectionAccessInput = {
orgWide: boolean;
memberIds: string[];
teamIds: string[];
};
export type CreateMcpConnectionInput = {
name: string;
url: string;
authType: ExternalMcpAuthType;
credentialMode: ExternalMcpCredentialMode;View on GitHub (pinned to 2b7df46e8a)
Solutions
- For 404/501, align client and server versions — the deployed Den server must support the presets endpoint.
- For 401/403, re-authenticate and check read permissions.
- For 5xx, rely on TanStack Query retry/backoff and check Den server health.
- Because consumers default to [], decide deliberately whether silently showing zero presets is acceptable or the error should surface; use isReauthRequiredError for the re-auth flow.
Example fix
// before
const { data: presets = [] } = useMcpConnectionPresets();
// after
const { data: presets = [], error } = useMcpConnectionPresets();
if (error && !/\((404|501)\)/.test(error.message)) {
if (isReauthRequiredError(error)) startReauth();
else showError(error.message);
} Defensive patterns
Strategy: fallback
Validate before calling
// cheap pre-flight
if (!sessionValid()) throw new Error("Sign in to load MCP presets"); Type guard
function isEndpointMissing(err: unknown): boolean {
return err instanceof Error && /\((404|501)\)/.test(err.message);
} Try / catch
const { data: presets = [], error } = useMcpConnectionPresets();
const effectivePresets = error && isEndpointMissing(error) ? BUNDLED_FALLBACK_PRESETS : presets;
if (error && !isEndpointMissing(error) && !isReauthRequiredError(error)) showError(error.message); Prevention
- Deploy Den server and web client together so the presets endpoint always exists
- Ship a bundled fallback preset list for older servers
- Refresh sessions before entering setup flows
- Distinguish missing-endpoint (404/501) from transient 5xx when deciding to fall back
When it happens
Trigger: Non-ok response fetching the preset catalog: 401 for an expired session, 403 when the user cannot read org marketplace presets, 404/501 when the server version predates the presets endpoint (API mismatch), 5xx during server faults or deploys.
Common situations: A Den server older than the web client calling a not-yet-deployed endpoint; expired session; transient 5xx during a deploy; restricted role without preset read access.
Understand the failure class
Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.
Related errors
- Failed to configure plugin connection (${response.status}).
- Failed to inspect MCP tools (${response.status}).
- Failed to update MCP tool policy (${response.status}).
- Failed to load MCP connectors (${response.status}).
- Failed to look up the MCP server (${response.status}).
AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01).
Data as JSON: /api/errors/a50ed6857c099915.
Report an issue: GitHub.