ChatGPTNextWeb/NextChat · warning · Error
Failed to load preset servers
Error message
Failed to load preset servers
What it means
Thrown at app/components/mcp-market.tsx:99 inside the loadPresetServers useEffect when fetch('https://nextchat.club/mcp/list') resolves with response.ok === false. The preset (marketplace) server list is fetched from a remote host on first mount when MCP is enabled; any non-2xx from nextchat.club triggers this throw (which is then caught and shown as a toast).
Source
Thrown at app/components/mcp-market.tsx:99
};
// 立即执行一次
updateStatuses();
// 每 1000ms 轮询一次
const timer = setInterval(updateStatuses, 1000);
return () => clearInterval(timer);
}, [mcpEnabled, config]);
// 加载预设服务器
useEffect(() => {
const loadPresetServers = async () => {
if (!mcpEnabled) return;
try {
setLoadingPresets(true);
const response = await fetch("https://nextchat.club/mcp/list");
if (!response.ok) {
throw new Error("Failed to load preset servers");
}
const data = await response.json();
setPresetServers(data?.data ?? []);
} catch (error) {
console.error("Failed to load preset servers:", error);
showToast("Failed to load preset servers");
} finally {
setLoadingPresets(false);
}
};
loadPresetServers();
}, [mcpEnabled]);
// 加载初始状态
useEffect(() => {
const loadInitialState = async () => {
if (!mcpEnabled) return;
try {View on GitHub (pinned to defdcdb55d)
Solutions
- Confirm outbound HTTPS to https://nextchat.club/mcp/list works from the host (curl it).
- Treat preset load failure as non-fatal (already caught): the component already shows a toast and keeps presetServers empty, so just ensure the marketplace UI degrades to 'unavailable' gracefully.
- If deploying offline, host the preset list locally and make the URL configurable instead of hard-coded.
- Add retry/backoff for transient failures and cache the last good list in localStorage.
Example fix
// before
const response = await fetch("https://nextchat.club/mcp/list");
if (!response.ok) {
throw new Error("Failed to load preset servers");
}
// after
const PRESET_URL = process.env.NEXTCHAT_PRESET_URL ?? "https://nextchat.club/mcp/list";
let response: Response;
try {
response = await fetch(PRESET_URL);
} catch (e) {
setPresetServers([]);
showToast("Marketplace unreachable");
return;
}
if (!response.ok) {
setPresetServers([]);
showToast(`Marketplace returned ${response.status}`);
return;
} Defensive patterns
Strategy: fallback
Validate before calling
async function presetListReachable(): Promise<boolean> {
try {
const res = await fetch("https://nextchat.club/mcp/list", { method: "HEAD" });
return res.ok;
} catch {
return false;
}
}
if (!(await presetListReachable())) {
setPresetServers([]); // degrade gracefully
} Type guard
function isPresetListResponse(
data: unknown,
): data is { data: unknown[] } {
return typeof data === "object" && data !== null && Array.isArray((data as any).data);
} Try / catch
// already handled in-component; ensure the catch keeps the UI usable:
try {
const response = await fetch("https://nextchat.club/mcp/list");
if (!response.ok) throw new Error("Failed to load preset servers");
setPresetServers((await response.json())?.data ?? []);
} catch {
setPresetServers([]);
showToast("Marketplace unavailable");
} finally {
setLoadingPresets(false);
} Prevention
- Make the marketplace URL configurable for offline/air-gapped deployments.
- Cache the last successful preset list in localStorage and serve it when the fetch fails.
- Treat marketplace unavailability as non-fatal — it must not block core MCP features.
When it happens
Trigger: The nextchat.club service is down or returns 5xx; the endpoint path changed (404); a non-2xx is returned due to maintenance, auth, or rate limiting; the client is behind a proxy/firewall that intercepts the request with a non-2xx; an offline/air-gapped deployment that cannot reach nextchat.club.
Common situations: Self-hosted NextChat in an air-gapped or corporate network with no outbound access to nextchat.club; the marketplace service is temporarily unavailable; CDN/WAF in front of nextchat.club blocks the request; user has DNS that resolves but the TLS/network layer returns a non-2xx error page.
Related errors
- Failed to load tools
- Failed to query usage from openai
- Server ${clientId} not found
- Client ${clientId} not found
- Network response was not ok
AI-assisted analysis of ChatGPTNextWeb/NextChat@defdcdb55d (2026-08-12).
Data as JSON: /api/errors/15a63896f0cb6d4f.
Report an issue: GitHub.