unslothai/unsloth · error
Request failed (${status})
Error message
Request failed (${status}) What it means
Generic failure from mcpRequest, the shared wrapper for all /api/mcp/servers CRUD calls. After special-casing 204 (DELETE success with no body), it parses the JSON body and throws when !response.ok. parseErrorText prefers a FastAPI detail (formatted via formatFastApiDetail) or message field, and this listed fallback 'Request failed (status)' only appears when the error body is empty or unparseable.
Source
Thrown at studio/frontend/src/features/chat/api/mcp-servers-api.ts:52
if (formatted) return formatted;
if (typeof message === "string" && message) return message;
}
return `Request failed (${status})`;
}
async function mcpRequest<T>(
path: string,
init?: { method?: string; body?: object },
): Promise<T> {
const response = await authFetch(`/api/mcp/servers${path}`, {
method: init?.method,
headers: init?.body ? { "Content-Type": "application/json" } : undefined,
body: init?.body ? JSON.stringify(init.body) : undefined,
});
// 204 No Content (DELETE) has no body — calling .json() would throw.
if (response.status === 204) return undefined as T;
const json = await response.json().catch(() => null);
if (!response.ok) throw new Error(parseErrorText(response.status, json));
return json as T;
}
export function listMcpServers(): Promise<McpServerConfig[]> {
return mcpRequest("/");
}
export function createMcpServer(payload: {
displayName: string;
url: string;
headers?: Record<string, string>;
isEnabled?: boolean;
useOauth?: boolean;
}): Promise<McpServerConfig> {
return mcpRequest("/", {
method: "POST",
body: {
display_name: payload.displayName,View on GitHub (pinned to 203007d190)
Solutions
- Read the message: a real detail from the backend names the failing field or connection error; the bare 'Request failed (status)' fallback means the body was empty — check backend logs.
- Validate the MCP server URL and headers before submitting.
- Confirm the MCP server itself is reachable from the backend (not just from the browser).
- Re-auth if status is 401/403.
Defensive patterns
Strategy: validation
Validate before calling
// Validate before create
const url = new URL(payload.url); // throws on malformed URL
if (!/^https?:$/.test(url.protocol)) throw new Error('MCP server URL must be http(s)'); Try / catch
try { await createMcpServer(payload); }
catch (e) { showFormError(e.message); // message carries FastAPI detail when present } Prevention
- Client-side validate URL/header shape before hitting the API.
- Health-check MCP reachability from the backend, not the browser.
- Distinguish empty-body fallback messages ('Request failed (n)') — they mean 'check server logs'.
When it happens
Trigger: listMcpServers ('/'), createMcpServer, update, delete, or health-check calls returning 4xx/5xx — e.g. invalid MCP server URL (422), duplicate server name, auth failure, or backend unable to reach the configured MCP server.
Common situations: Registering an MCP server with an unreachable/wrong URL; header schema violations; server-side MCP connection failures surfacing as 502; expired session.
Related errors
- family {getattr(fam, 'name', fam)!r} declares no prequant_fi
- lockfile not found: {path}
- load timed out (last progress: {prog})
- Unsupported diffusion memory_mode '{value}'. Use one of: {va
- Unsupported text_encoder_quant '{value}'. Use one of: {', '.
AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15).
Data as JSON: /api/errors/9a8220fb4d8f3efd.
Report an issue: GitHub.