{"record":{"id":"4e41c1a8886a674c","repo":"risingwavelabs/risingwave","slug":"context-0-not-found","errorCode":null,"errorMessage":"Context {0} not found","messagePattern":"Context (.+?) not found","errorType":"exception","errorClass":"ExprError","httpStatus":null,"severity":"error","filePath":"src/expr/core/src/error.rs","lineNumber":102,"sourceCode":"        #[backtrace]\n        ArrayError,\n    ),\n\n    #[error(\"More than one row returned by {0} used as an expression\")]\n    MaxOneRow(&'static str),\n\n    /// TODO: deprecate in favor of `Function`\n    #[error(transparent)]\n    Internal(\n        #[from]\n        #[backtrace]\n        anyhow::Error,\n    ),\n\n    #[error(\"not a constant\")]\n    NotConstant,\n\n    #[error(\"Context {0} not found\")]\n    Context(&'static str),\n\n    #[error(\"field name must not be null\")]\n    FieldNameNull,\n\n    #[error(\"too few arguments for format()\")]\n    TooFewArguments,\n\n    #[error(\n        \"null value in column \\\"{col_name}\\\" of relation \\\"{table_name}\\\" violates not-null constraint\"\n    )]\n    NotNullViolation {\n        col_name: Box<str>,\n        table_name: Box<str>,\n    },\n\n    #[error(\"invalid state: {0}\")]\n    InvalidState(String),","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/expr/core/src/error.rs#L84-L120","documentation":"ExprError::Context(&'static str) indicates that an expected evaluation/planning context object was not found; the interpolated string names which context is missing. Expression evaluation sometimes depends on ambient context (e.g. timezone config, session information, lambda context) that must be installed by the caller before evaluation.","triggerScenarios":"Evaluating an expression that needs a registered context (e.g. timezone context for time functions) in a driver that never set it up; looking up a named context in a context registry with a key that wasn't inserted.","commonSituations":"Embedding the expression engine without wiring session/config context, tests calling `eval` directly without the standard context setup, refactors renaming context keys while old lookups remain.","solutions":["Install/provide the required context (e.g. timezone/session context) before evaluating the expression.","Fix the context key/name used in the lookup to match what was registered.","In embedded usage, initialize the same context builders the standard engine entry points use."],"exampleFix":"// before\nlet ctx = contexts.get(\"tz\").ok_or(ExprError::Context(\"tz\"))?;\n// after\nlet ctx = contexts.entry(\"tz\").or_insert_with(TimeZoneContext::default); // or ensure setup_eval_context(&mut contexts) first","handlingStrategy":"validation","validationCode":"// Ensure the context is registered before evaluation\nif contexts.get(\"tz\").is_none() {\n    contexts.insert(\"tz\".into(), Box::new(TimeZoneContext::default()));\n}","typeGuard":"fn has_context(ctxs: &Contexts, key: &'static str) -> bool {\n    ctxs.get(key).is_some()\n}","tryCatchPattern":"// Missing context is a setup bug: fail fast with a clear message\nif let Some(ExprError::Context(name)) = err.downcast_ref::<ExprError>() {\n    panic!(\"evaluation context '{name}' was not initialized\");\n}","preventionTips":["Initialize all evaluation contexts in one shared setup function.","Reuse the engine's standard entry points instead of calling eval directly in tests.","Keep context keys in constants to avoid rename drift."],"tags":["rust","context","evaluation"],"backgroundTag":"missing-required-config-field","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}