windmill-labs/windmill · error

missing 'value' - paste a whole OpenFlow document, not just

Error message

missing 'value' - paste a whole OpenFlow document, not just its value

What it means

validateShape in FlowYamlEditor.svelte parses the pasted YAML and enforces the OpenFlow document structure. The flow must be a top-level mapping containing a 'value' key whose content is itself a mapping (the actual flow body with 'modules', etc.). This error fires when the parsed YAML is missing 'value' or when 'value' is a scalar, null, or array instead of a mapping — typically because only the inner flow value was pasted.

Source

Thrown at frontend/src/lib/components/flows/header/FlowYamlEditor.svelte:44

	let hasChanges = $derived(code !== initialCode)

	function reload() {
		code = YAML.stringify(filteredContentForExport(flowStore.val))
		initialCode = code
		editor?.setCode(code)
	}

	/** `value` is assigned unconditionally below and `FlowEditor` dereferences
	 * `flowStore.val.value.modules`, so an OpenFlow document missing it takes the
	 * whole editor down mid-render — after the toast has already claimed success.
	 * Reject it up front instead. */
	function validateShape(parsed: unknown) {
		if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
			throw new Error('the document must be a mapping (key: value)')
		}
		const value = (parsed as Record<string, unknown>).value
		if (typeof value !== 'object' || value === null || Array.isArray(value)) {
			throw new Error("missing 'value' - paste a whole OpenFlow document, not just its value")
		}
		if (!Array.isArray((value as Record<string, unknown>).modules)) {
			throw new Error("'value.modules' must be a list")
		}
	}

	function validateGroups(groups: { start_id: string; end_id: string }[] | undefined) {
		if (!groups) return
		const seen = new Set<string>()
		for (const g of groups) {
			const key = `${g.start_id}:${g.end_id}`
			if (seen.has(key)) {
				throw new Error(`Duplicate group: '${g.start_id}' → '${g.end_id}'`)
			}
			seen.add(key)
		}
	}

View on GitHub (pinned to e474e8803c)

Solutions

  1. Paste the complete OpenFlow document, wrapping the flow body under a top-level 'value:' key
  2. Verify the YAML parses as an object: the root must be a mapping, not a list or scalar
  3. Ensure 'value:' is at the root indentation level and its content is nested under it, not quoted as a string
  4. Cross-check against a working flow exported from the UI (Download flow as YAML) and mimic its shape

Example fix

// before (only the flow body pasted)
modules:
  - id: a
    value:
      type: rawscript
// after (whole OpenFlow document)
summary: my flow
value:
  modules:
    - id: a
      value:
        type: rawscript
Defensive patterns

Strategy: validation

Validate before calling

const parsed = yaml.load(text)
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed) || typeof parsed.value !== 'object' || parsed.value === null || Array.isArray(parsed.value)) {
  alert('Paste a whole OpenFlow document (root must contain a "value" mapping)')
} else {
  editor.apply(parsed)
}

Type guard

function isRecord(v: unknown): v is Record<string, unknown> {
  return typeof v === 'object' && v !== null && !Array.isArray(v)
}

Try / catch

try {
  editor.apply(yamlText)
} catch (e) {
  if (e.message.includes("missing 'value'")) {
    sendUserToast('Paste the full OpenFlow document, not just the value section', true)
  }
}

Prevention

When it happens

Trigger: Calling apply() → validateShape() with YAML whose root has no 'value' key, or whose 'value' is a scalar/null/array instead of an object (e.g. pasting only the flow body, or a document that is a plain list of steps).

Common situations: User copies just the flow definition (steps/modules) from docs or another tool and pastes it into the YAML editor instead of the whole OpenFlow document including the 'summary' and 'value' wrapper; a hand-written YAML where 'value:' is indented wrong so it parses as a sibling key or string.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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