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

  1. Fix the YAML so the top level is a mapping (key: value pairs)
  2. If the file should be empty/placeholder, give it valid object content or delete it from the sync folder
  3. 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

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


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/6038910b24a6675b. Report an issue: GitHub.