srbhr/Resume-Matcher · error · Error
Failed to load language config (status ${res.status}).
Error message
Failed to load language config (status ${res.status}). What it means
fetchLanguageConfig calls GET /config/language with credentials and throws this Error when the response is not ok. Like the other fetch wrappers it drops the response body, so only the status code is available for diagnosis.
Source
Thrown at apps/frontend/lib/api/config.ts:268
export type SupportedLanguage = 'en' | 'es' | 'zh' | 'ja' | 'pt' | 'fr' | 'ko';
export interface LanguageConfig {
ui_language: SupportedLanguage;
content_language: SupportedLanguage;
supported_languages: SupportedLanguage[];
}
export interface LanguageConfigUpdate {
ui_language?: SupportedLanguage;
content_language?: SupportedLanguage;
}
// Fetch language configuration
export async function fetchLanguageConfig(): Promise<LanguageConfig> {
const res = await apiFetch('/config/language', { credentials: 'include' });
if (!res.ok) {
throw new Error(`Failed to load language config (status ${res.status}).`);
}
return res.json();
}
// Update language configuration
export async function updateLanguageConfig(update: LanguageConfigUpdate): Promise<LanguageConfig> {
const res = await apiFetch('/config/language', {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
credentials: 'include',
body: JSON.stringify(update),
});
if (!res.ok) {
const data = await res.json().catch(() => ({}));
throw new Error(data.detail || `Failed to update language config (status ${res.status}).`);
}View on GitHub (pinned to 116f9cc3b0)
Solutions
- Re-login if the status is 401/403
- Confirm the backend version exposes GET /config/language (404)
- Inspect backend logs for 500 root causes
- Verify the frontend API base URL and proxy configuration
Example fix
// before const lc = await fetchLanguageConfig(); // after const lc = await fetchLanguageConfig().catch(() => DEFAULT_LANGUAGE_CONFIG);
Defensive patterns
Strategy: fallback
Validate before calling
const sessionOk = document.cookie.includes('session');
if (!sessionOk) await ensureLogin(); // before GET /config/language Type guard
function isLanguageConfigError(e: unknown): e is Error & { status?: number } {
const m = e instanceof Error ? e.message.match(/status (\d{3})/) : null;
if (e instanceof Error && m) (e as any).status = Number(m[1]);
return e instanceof Error;
} Try / catch
let langConfig: LanguageConfig;
try {
langConfig = await fetchLanguageConfig();
} catch {
langConfig = DEFAULT_LANGUAGE_CONFIG;
} Prevention
- Keep frontend/backend in version lockstep so the language route exists
- Provide DEFAULT_LANGUAGE_CONFIG matching backend defaults
- Handle 401 by redirecting to login rather than surfacing a raw error
- Smoke-test GET /config/language in deployment checks
When it happens
Trigger: GET /config/language returns non-OK: 401 unauthenticated, 404 route absent (older backend), 500 backend language-config store failure.
Common situations: Opening the language settings with an expired session; frontend/backend version skew where the language config API was added later; backend storage error on startup.
Understand the failure class
Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.
Related errors
- Failed to load LLM config (status ${res.status}).
- ${message = data.detail or Failed to update LLM config (stat
- Failed to load feature config (status ${res.status}).
- ${data.detail || Failed to update feature config (status ${r
- ${data.detail || Failed to update language config (status ${
AI-assisted analysis of srbhr/Resume-Matcher@116f9cc3b0 (2026-08-28).
Data as JSON: /api/errors/8a72014c381e9854.
Report an issue: GitHub.