windmill-labs/windmill · error · Error
Expected local yaml ${path} to be an object, found: ${conten
Error message
Expected local yaml ${path} to be an object, found: ${content} instead What it means
While updating a local YAML file's codebase digest, sync code expects the file to parse into a top-level object/mapping. If the parsed YAML is a scalar, array or other non-object, addCodebaseDigestIfRelevant throws this error showing the raw content found.
Source
Thrown at cli/src/commands/sync/sync.ts:649
let parsed: any;
try {
parsed = yamlParseContent(path, content);
} catch (error) {
log.error(
`Failed to parse YAML content for codebase digest at path: ${path}`,
);
throw error;
}
if (parsed && typeof parsed == "object") {
if (ignoreCodebaseChanges) {
parsed["codebase"] = undefined;
} else {
parsed["codebase"] = await c.getDigest();
}
parsed["lock"] = "";
return yamlStringify(parsed, yamlOptions);
} else {
throw Error(
`Expected local yaml ${path} to be an object, found: ${content} instead`,
);
}
}
}
return content;
}
/**
* Whether a script's modules ARE a dbt project.
*
* Keyed on `dbt_project.yml` rather than on the descriptor: the descriptor is
* optional, so its absence says nothing, while a dbt project without
* `dbt_project.yml` is one dbt itself refuses to run.
*
* Its LANGUAGE decides, not its name. A dbt bundle is read verbatim and every
* file in it is stored as `dbt`; an ordinary modular script that happens to
* vendor a dbt project stores that same file as whatever its extension infers,View on GitHub (pinned to e474e8803c)
Solutions
- Fix the YAML so the top level is a mapping (key: value pairs)
- If the file should be empty/placeholder, give it valid object content or delete it from the sync folder
- Validate the YAML locally (yamllint or a quick parse) to spot the structural break
Example fix
// before (broken YAML) just a string // after summary: my resource value: 42
Defensive patterns
Strategy: validation
Validate before calling
const parsed = yamlParse(await Deno.readTextFile(path)); if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) throw new Error(`${path} must contain a YAML object`); Type guard
function isYamlObject(v: unknown): v is Record<string, unknown> { return v !== null && typeof v === 'object' && !Array.isArray(v); } Try / catch
try { await syncPush(); } catch (e) { if (String(e.message).startsWith('Expected local yaml')) { console.error('Fix the YAML structure named in the error to be a top-level object.'); } else throw e; } Prevention
- Run yamllint on the sync folder in CI
- Never leave empty or scalar-only .yaml files in a synced folder
- Check indentation after hand edits — top level must stay a mapping
When it happens
Trigger: Running wmill sync (addCodebaseDigestIfRelevant) on a local *.yaml file whose content parses to a non-mapping (e.g. an empty file, a plain string, or a list).
Common situations: Hand-edited YAML that collapsed to a scalar (missing keys/indentation); an empty .yaml file; a YAML file intended as data, not a Windmill resource definition; YAML anchor/indent mistakes.
Related errors
- Error parsing yaml ${path}
- YAML sync failed
- YAML emit error: {}
- no policy could be derived for runnable(s) ${malformed.join(
- Workspace folder not found, are you in the right directory?
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/6038910b24a6675b.
Report an issue: GitHub.