{"record":{"id":"1997f5b24651f71a","repo":"windmill-labs/windmill","slug":"quickjs-evaluation-error","errorCode":null,"errorMessage":"QuickJS evaluation error: {}","messagePattern":"QuickJS evaluation error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/windmill-jseval/src/lib.rs","lineNumber":419,"sourceCode":"        }\n        rquickjs::CaughtError::Value(v) => v.is_null() || v.is_undefined(),\n        rquickjs::CaughtError::Error(_) => false,\n    };\n    if is_oom {\n        let remediation = match env_override {\n            Some(var) => format!(\n                \"Reduce the amount of data handled in the expression, or raise the \\\n                 cap via the {var} environment variable.\"\n            ),\n            None => \"Reduce the amount of data handled in the expression.\".to_string(),\n        };\n        anyhow::anyhow!(\n            \"The expression evaluation exceeded the memory limit of {} MB. {}\",\n            memory_limit / (1024 * 1024),\n            remediation\n        )\n    } else {\n        anyhow::anyhow!(\"QuickJS evaluation error: {}\", err)\n    }\n}\n\n#[cfg(feature = \"quickjs\")]\nasync fn eval_quickjs_inner(\n    expr: &str,\n    transform_context: HashMap<String, Arc<Box<RawValue>>>,\n    flow_input: Option<mappable_rc::Marc<HashMap<String, Box<RawValue>>>>,\n    flow_env: Option<HashMap<String, Box<RawValue>>>,\n    authed_client: Option<AuthedClient>,\n    by_id: Option<IdContext>,\n    extra_ctx: Option<Vec<(String, String)>>,\n    context_keys: Vec<String>,\n    memory_limit: usize,\n) -> anyhow::Result<Box<RawValue>> {\n    let runtime = AsyncRuntime::new()?;\n    runtime.set_memory_limit(memory_limit).await;\n    let context = AsyncContext::full(&runtime).await?;","sourceCodeStart":401,"sourceCodeEnd":437,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/windmill-jseval/src/lib.rs#L401-L437","documentation":"Generic wrapper: any QuickJS runtime error during expression evaluation that is not a memory-limit abort is converted to 'QuickJS evaluation error: <detail>'. The original QuickJS error text is embedded, e.g. syntax errors, TypeError, undefined variable.","triggerScenarios":"A transform expression with a JavaScript syntax error, a reference to an undefined variable/property, calling a non-function, or any runtime exception raised inside the QuickJS sandbox.","commonSituations":"Typos in property names of previous-step results; assuming a field exists on all items of an array; paste-in JS that relies on browser/node APIs unavailable in the sandbox.","solutions":["Read the embedded QuickJS message to identify the failing expression part","Test the expression against the actual step data shape (guard optional fields with ?. and ??)","Fix syntax/runtime errors, then redeploy the flow"],"exampleFix":"// before\nresults.user.profile.email  // TypeError if profile undefined\n// after\nresults.user?.profile?.email ?? null","handlingStrategy":"try-catch","validationCode":"// guard references before eval\nif (!results?.user?.profile) throw new Error('results.user.profile missing');","typeGuard":null,"tryCatchPattern":"try {\n  return await evalExpression(expr, inputs);\n} catch (e) {\n  if (String(e).startsWith('QuickJS evaluation error')) {\n    console.error('expression failed:', e); // inspect embedded QuickJS message\n  }\n  throw e;\n}","preventionTips":["Use optional chaining for possibly-missing fields","Test expressions against real step data shapes","Only use JS available in the QuickJS sandbox (no node/browser APIs)"],"tags":["javascript","runtime-error","flows"],"backgroundTag":"javascript-runtime-error","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"}