windmill-labs/windmill · error · Error
YAML sync failed
Error message
YAML sync failed
What it means
handleSave in SuperadminSettings first asks the inner settings component to sync its form state into YAML (syncBeforeDiff) before persisting. If the inner component reports sync failure (falsy return), the save aborts with this Error so a stale-YAML write never happens silently.
Source
Thrown at frontend/src/lib/components/SuperadminSettings.svelte:72
function handleClose() {
if (hasUnsavedChanges) {
showCloseConfirmModal = true
} else {
closeDrawer()
}
}
/** Catches click-away and escape closes from the Drawer/Disposable layer */
function handleDrawerClose() {
if (!bypassCloseCheck && hasUnsavedChanges) {
drawer?.openDrawer()
showCloseConfirmModal = true
}
bypassCloseCheck = false
}
async function handleSave(): Promise<void> {
if (!innerComponent?.syncBeforeDiff()) throw new Error('YAML sync failed')
await innerComponent?.saveSettings()
}
async function handleSaveAndCloseDiff(): Promise<void> {
await handleSave()
diffDrawer?.closeDrawer()
}
function handleDiscard() {
innerComponent?.discardAll()
}
function handleReviewChanges() {
if (!innerComponent?.syncBeforeDiff()) return
diffData = innerComponent?.buildFullDiff() ?? { original: '', modified: '' }
diffDrawer?.openDrawer()
}
</script>View on GitHub (pinned to e474e8803c)
Solutions
- Fix YAML syntax errors in the settings YAML editor so it parses and syncs
- Reopen the settings/diff drawer to remount the inner component and retry
- Check the browser console for the underlying sync error reported by the inner component
- Save via the form (not the diff drawer) if the YAML state is unrecoverable
Example fix
// before
if (!innerComponent?.syncBeforeDiff()) throw new Error('YAML sync failed')
// after
if (!innerComponent) throw new Error('Settings not loaded yet')
if (!innerComponent.syncBeforeDiff()) {
sendUserToast('Could not sync YAML settings — check YAML syntax', true)
return
} Defensive patterns
Strategy: validation
Validate before calling
// validate YAML parses before attempting save/sync
try { window.jsyaml.load(yamlText) } catch (e) { sendUserToast('Invalid YAML: ' + e.message, true) } Type guard
function innerReady(c: unknown): c is { syncBeforeDiff(): boolean; saveSettings(): Promise<void> } {
return !!c && typeof (c as any).syncBeforeDiff === 'function'
} Try / catch
try {
await handleSave()
} catch (e) {
if (e.message === 'YAML sync failed') {
sendUserToast('Fix YAML syntax before saving', true)
} else throw e
} Prevention
- Validate YAML in the editor before opening the diff drawer
- Let the inner component fully mount before enabling save buttons
- Avoid hand-editing YAML unless it parses cleanly
When it happens
Trigger: Clicking save (or Save-and-close-diff via handleSaveAndCloseDiff) when innerComponent?.syncBeforeDiff() returns false — the YAML editor content could not be reconciled with form state, typically due to invalid YAML or a desynchronized inner component ref.
Common situations: Hand-edited YAML in the diff drawer with syntax errors; switching between form and YAML views leaving stale state; innerComponent ref not yet mounted when save is triggered.
Related errors
- Expected local yaml ${path} to be an object, found: ${conten
- Workspace folder not found, are you in the right directory?
- Not a fileset resource path: ${changePath}
- No resource metadata file found for fileset resource: ${chan
- raw app path ${JSON.stringify(relPath)} escapes the app fold
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/656b47641ec69ceb.
Report an issue: GitHub.