windmill-labs/windmill · error
res.statusText
Error message
res.statusText
What it means
syncCachedResourceTypes POSTs to /api/settings/sync_cached_resource_types and throws Error(body || res.statusText) on a non-OK response. When the backend returns no body, the thrown message falls back to res.statusText (e.g. 'Forbidden', 'Internal Server Error'), surfacing the HTTP failure in the settings UI.
Source
Thrown at frontend/src/routes/(root)/(logged)/user/(user)/instance_settings/+page.svelte:109
let newPassword = $state('')
let enableHubSync = $state(true)
let accountSubmitting = $state(false)
let accountError = $state('')
let showOssAccountDialog = $state(false)
let ossAccountError = $state('')
// --- Resource type sync (triggered on entering account step) ---
let rtSyncStatus: 'idle' | 'loading' | 'success' | 'error' = $state('idle')
let rtSyncMessage = $state('')
async function syncCachedResourceTypes() {
rtSyncStatus = 'loading'
rtSyncMessage = ''
try {
const res = await fetch('/api/settings/sync_cached_resource_types', { method: 'POST' })
if (!res.ok) {
const body = await res.text()
throw new Error(body || res.statusText)
}
rtSyncMessage = await res.text()
rtSyncStatus = 'success'
} catch (e: any) {
rtSyncMessage = e?.message ?? 'Failed to sync resource types'
rtSyncStatus = 'error'
}
}
$effect(() => {
if (
rtSyncStatus === 'idle' &&
((mode === 'wizard' && !isSettingsStep(wizardStep)) || (mode === 'full' && fullStep === 1))
) {
syncCachedResourceTypes()
}
})
View on GitHub (pinned to e474e8803c)
Solutions
- Log in as the instance superadmin (admin@windmill.dev) — the endpoint is superadmin-only
- Check the backend logs for the sync handler's failure and fix the underlying cause
- Ensure backend and frontend versions match so the endpoint exists
- Inspect the network tab: the response body/status tells whether it's 403 auth or 500 server error
Example fix
// before
throw new Error(body || res.statusText)
// after
throw new Error(`sync_cached_resource_types failed (${res.status}): ${body || res.statusText}`) Defensive patterns
Strategy: try-catch
Validate before calling
// confirm superadmin session before syncing
const me = await fetch('/api/users/me', { credentials: 'include' })
if (!me.ok || !(await me.json())?.is_admin) {
sendUserToast('Instance superadmin required to sync resource types', true)
return
} Try / catch
try {
await syncCachedResourceTypes()
} catch (e) {
if (e.message === 'Forbidden') sendUserToast('Log in as instance superadmin', true)
else if (e.message === 'Not Found') sendUserToast('Backend too old for this endpoint — upgrade', true)
else sendUserToast(e.message || 'Failed to sync resource types', true)
} Prevention
- Gate the sync button on superadmin status so it's not clickable for plain admins
- Keep backend and frontend versions in lockstep
- Include HTTP status in thrown messages for faster diagnosis
- Check backend logs whenever the sync returns an empty body
When it happens
Trigger: Clicking the resource-type sync action in instance settings while the POST returns 4xx/5xx — e.g. non-superadmin session (403), endpoint missing on older backend (404), or backend failure computing the sync (500) with an empty body.
Common situations: Logged in as a workspace admin rather than instance superadmin; running a frontend newer than the backend so /api/settings/sync_cached_resource_types does not exist; backend crash during sync leaving an empty error body.
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
- body || res.statusText
- HTTP ${response.status}
- GET /assets/graph → ${res.status}
- Could not determine current admin email
- ApiError with mapped HTTP status message (e.g. "Not Found",
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/2ed1d1177a84d91d.
Report an issue: GitHub.