{"record":{"id":"3e09f3a6f6abbfb0","repo":"windmill-labs/windmill","slug":"eval-error-in-app-input-id-with-key-key","errorCode":null,"errorMessage":"Eval error in app input '${id}' with key '${key}'","messagePattern":"Eval error in app input '(.+?)' with key '(.+?)'","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"frontend/src/lib/components/apps/components/helpers/InputValue.svelte","lineNumber":260,"sourceCode":"\t\t\t)\n\t\t\tconst r = await eval_like(\n\t\t\t\tinput.expr,\n\t\t\t\tcontext,\n\t\t\t\t$stateStore,\n\t\t\t\t$mode == 'dnd',\n\t\t\t\t$componentControl,\n\t\t\t\t$worldStore,\n\t\t\t\t$runnableComponents,\n\t\t\t\tfalse,\n\t\t\t\tgroupContext?.id,\n\t\t\t\tget(recomputeAllContext)?.onRefresh\n\t\t\t)\n\t\t\terror = ''\n\t\t\treturn r\n\t\t} catch (e) {\n\t\t\terror = e.message\n\t\t\ttry {\n\t\t\t\tconsole.warn(\"Eval error in app input '\" + id + \"' with key '\" + key + \"'\", e)\n\t\t\t} catch (e) {\n\t\t\t\tconsole.warn('error warning', e)\n\t\t\t}\n\t\t\treturn value\n\t\t}\n\t}\n\n\tasync function getValue(input: AppInput) {\n\t\tif (iterContext && $iterContext.disabled) return\n\n\t\tif (!input) return\n\t\tif ((input.type === 'template' || input.type == 'templatev2') && isCodeInjection(input.eval)) {\n\t\t\ttry {\n\t\t\t\tconst r = await eval_like(\n\t\t\t\t\t'`' + escapeTemplateBackticks(input.eval) + '`',\n\t\t\t\t\tcomputeGlobalContext($worldStore, id, fullContext),\n\t\t\t\t\t$stateStore,\n\t\t\t\t\t$mode == 'dnd',","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/apps/components/helpers/InputValue.svelte#L242-L278","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the logged Error object (second console.warn arg) to see the actual exception message.","Fix the expression in the app editor — reference existing component ids and guard against undefined.","Add optional chaining / defaults in the expression: `result?.value ?? ''`.","Verify dependent components exist and data is loaded before the expression runs."],"exampleFix":"// before\n{{ items[0].name }}\n// after\n{{ items?.[0]?.name ?? 'none' }}","handlingStrategy":"fallback","validationCode":"// validate expression inputs before evaluating\nfunction safeEval(expr, ctx) {\n  if (expr == null || typeof expr !== 'string') return value;\n  const refs = /\\b(\\w+)\\b/g.exec(expr);\n  return expr; // and prefer optional chaining inside the expression itself\n}","typeGuard":"null","tryCatchPattern":"try {\n  r = evaluate(expr);\n  error = '';\n} catch (e) {\n  error = e.message;\n  console.warn(\"Eval error in app input '\" + id + \"' with key '\" + key + \"'\", e);\n  return value; // fallback to previous/default value\n}","preventionTips":["Use optional chaining (`a?.b?.c`) in every app expression that touches possibly-missing state.","Re-check expressions after renaming or deleting app components.","Read the second argument of the console.warn for the underlying exception.","Prefer nullish coalescing defaults (`?? ''`) over direct property access."],"tags":["frontend","apps","expression-eval","javascript"],"backgroundTag":"expression-eval-failed","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}