windmill-labs/windmill · warning

Eval error in app input '${id}' with key '${key}'

Error message

Eval error in app input '${id}' with key '${key}'

What it means

In the Windmill app InputValue component, evalExpr evaluates an input expression (JavaScript referencing app state, results, etc.). If evaluation throws, the error message is shown in the component's `error` state and this console.warn is emitted with the failing input id/key; the component falls back to returning the previous/default value instead of crashing the app.

Source

Thrown at frontend/src/lib/components/apps/components/helpers/InputValue.svelte:260

			)
			const r = await eval_like(
				input.expr,
				context,
				$stateStore,
				$mode == 'dnd',
				$componentControl,
				$worldStore,
				$runnableComponents,
				false,
				groupContext?.id,
				get(recomputeAllContext)?.onRefresh
			)
			error = ''
			return r
		} catch (e) {
			error = e.message
			try {
				console.warn("Eval error in app input '" + id + "' with key '" + key + "'", e)
			} catch (e) {
				console.warn('error warning', e)
			}
			return value
		}
	}

	async function getValue(input: AppInput) {
		if (iterContext && $iterContext.disabled) return

		if (!input) return
		if ((input.type === 'template' || input.type == 'templatev2') && isCodeInjection(input.eval)) {
			try {
				const r = await eval_like(
					'`' + escapeTemplateBackticks(input.eval) + '`',
					computeGlobalContext($worldStore, id, fullContext),
					$stateStore,
					$mode == 'dnd',

View on GitHub (pinned to e474e8803c)

Solutions

  1. Read the logged Error object (second console.warn arg) to see the actual exception message.
  2. Fix the expression in the app editor — reference existing component ids and guard against undefined.
  3. Add optional chaining / defaults in the expression: `result?.value ?? ''`.
  4. Verify dependent components exist and data is loaded before the expression runs.

Example fix

// before
{{ items[0].name }}
// after
{{ items?.[0]?.name ?? 'none' }}
Defensive patterns

Strategy: fallback

Validate before calling

// validate expression inputs before evaluating
function safeEval(expr, ctx) {
  if (expr == null || typeof expr !== 'string') return value;
  const refs = /\b(\w+)\b/g.exec(expr);
  return expr; // and prefer optional chaining inside the expression itself
}

Type guard

null

Try / catch

try {
  r = evaluate(expr);
  error = '';
} catch (e) {
  error = e.message;
  console.warn("Eval error in app input '" + id + "' with key '" + key + "'", e);
  return value; // fallback to previous/default value
}

Prevention

When it happens

Trigger: Any app input configured as an expression whose evaluation throws: referencing an undefined component id, calling a method on null/undefined state, invalid JS syntax, or referencing a field of a not-yet-loaded result.

Common situations: Renaming or deleting a component while other inputs still reference its old id; expressions evaluated before async data arrives; typos like `resuls.value` instead of `result.value`; using unsupported syntax in the eval sandbox.

Related errors


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