{"record":{"id":"b892d732b85d7f51","repo":"influxdata/influxdb","slug":"regexmatch-function-not-registered","errorCode":null,"errorMessage":"RegexMatch function not registered","messagePattern":"RegexMatch function not registered","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/query_functions/src/lib.rs","lineNumber":70,"sourceCode":"pub use crate::regex::REGEX_MATCH_UDF_NAME;\npub use crate::regex::REGEX_NOT_MATCH_UDF_NAME;\npub use crate::regex::clean_non_meta_escapes;\npub use crate::sleep::SLEEP_UDF_NAME;\n\n/// A list of the numeric types supported by InfluxDB that can be be used\n/// as input to user-defined functions.\npub static NUMERICS: &[DataType] = &[DataType::Int64, DataType::UInt64, DataType::Float64];\n\n/// Return an Expr that invokes a InfluxRPC compatible regex match to\n/// determine which values satisfy the pattern. Equivalent to:\n///\n/// ```text\n/// col ~= /pattern/\n/// ```\npub fn regex_match_expr(input: Expr, pattern: String) -> Expr {\n    registry()\n        .udf(regex::REGEX_MATCH_UDF_NAME)\n        .expect(\"RegexMatch function not registered\")\n        .call(vec![input, lit(pattern)])\n}\n\n/// Return an Expr that invokes a InfluxRPC compatible regex match to\n/// determine which values do not satisfy the pattern. Equivalent to:\n///\n/// ```text\n/// col !~ /pattern/\n/// ```\npub fn regex_not_match_expr(input: Expr, pattern: String) -> Expr {\n    registry()\n        .udf(regex::REGEX_NOT_MATCH_UDF_NAME)\n        .expect(\"NotRegexMatch function not registered\")\n        .call(vec![input, lit(pattern)])\n}\n\n/// Create a DataFusion `Expr` that invokes `window_bounds` with the\n/// appropriate every and offset arguments at runtime","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/query_functions/src/lib.rs#L52-L88","documentation":"`regex_match_expr` builds a DataFusion expression that invokes the registered RegexMatch UDF. It panics with this message when `registry().udf(regex::REGEX_MATCH_UDF_NAME)` returns None, i.e. the RegexMatch UDF was never registered with the session context/registry. Registration is an invariant this public helper assumes was done at context setup.","triggerScenarios":"Calling `regex_match_expr(input, pattern)` against a registry that lacks the RegexMatch UDF — typically a SessionContext created without running the crate's UDF registration function.","commonSituations":"Creating a bare `SessionContext::new()` in application code or tests instead of using the library's registry builder; upgrading versions where the UDF name changed; forgetting to register query functions before planning queries that use `~=`.","solutions":["Register the crate's UDFs on the context before calling this helper (use the provided registry()/registration function).","Check that REGEX_MATCH_UDF_NAME is actually registered by listing registered UDFs.","If building contexts manually, add the RegexMatch UDF registration to your setup code."],"exampleFix":"// before\nlet ctx = SessionContext::new();\nlet expr = regex_match_expr(col(\"v\"), \"f.*\".to_string());\n// after\nlet ctx = SessionContext::new();\nregister_all_udfs(&ctx); // includes RegexMatch\nlet expr = regex_match_expr(col(\"v\"), \"f.*\".to_string());","handlingStrategy":"type-guard","validationCode":"debug_assert!(registry().udf(regex::REGEX_MATCH_UDF_NAME).is_some(), \"RegexMatch UDF not registered\");","typeGuard":"fn has_regex_match_udf(registry: &SessionContext) -> bool {\n    registry.udf(regex::REGEX_MATCH_UDF_NAME).is_some()\n}","tryCatchPattern":"let udf = registry().udf(regex::REGEX_MATCH_UDF_NAME)\n    .ok_or_else(|| anyhow!(\"RegexMatch UDF not registered\"))?;","preventionTips":["Use the library-provided context/registry factory rather than SessionContext::new()","Register all UDFs in one function so none can be omitted","Add an integration test asserting every public expr helper's UDF is present"],"tags":["rust","udf","regex","registry"],"backgroundTag":"internal-invariant-violation","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}