influxdata/influxdb · error

RegexMatch function not registered

Error message

RegexMatch function not registered

What it means

`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.

Solutions

  1. Register the crate's UDFs on the context before calling this helper (use the provided registry()/registration function).
  2. Check that REGEX_MATCH_UDF_NAME is actually registered by listing registered UDFs.
  3. If building contexts manually, add the RegexMatch UDF registration to your setup code.

Example fix

// before
let ctx = SessionContext::new();
let expr = regex_match_expr(col("v"), "f.*".to_string());
// after
let ctx = SessionContext::new();
register_all_udfs(&ctx); // includes RegexMatch
let expr = regex_match_expr(col("v"), "f.*".to_string());
Defensive patterns

Strategy: type-guard

Validate before calling

debug_assert!(registry().udf(regex::REGEX_MATCH_UDF_NAME).is_some(), "RegexMatch UDF not registered");

Type guard

fn has_regex_match_udf(registry: &SessionContext) -> bool {
    registry.udf(regex::REGEX_MATCH_UDF_NAME).is_some()
}

Try / catch

let udf = registry().udf(regex::REGEX_MATCH_UDF_NAME)
    .ok_or_else(|| anyhow!("RegexMatch UDF not registered"))?;

Prevention

When it happens

Trigger: 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.

Common situations: 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 `~=`.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19). Data as JSON: /api/errors/b892d732b85d7f51. Report an issue: GitHub.

Appendix: source

Thrown at core/query_functions/src/lib.rs:70

pub use crate::regex::REGEX_MATCH_UDF_NAME;
pub use crate::regex::REGEX_NOT_MATCH_UDF_NAME;
pub use crate::regex::clean_non_meta_escapes;
pub use crate::sleep::SLEEP_UDF_NAME;

/// A list of the numeric types supported by InfluxDB that can be be used
/// as input to user-defined functions.
pub static NUMERICS: &[DataType] = &[DataType::Int64, DataType::UInt64, DataType::Float64];

/// Return an Expr that invokes a InfluxRPC compatible regex match to
/// determine which values satisfy the pattern. Equivalent to:
///
/// ```text
/// col ~= /pattern/
/// ```
pub fn regex_match_expr(input: Expr, pattern: String) -> Expr {
    registry()
        .udf(regex::REGEX_MATCH_UDF_NAME)
        .expect("RegexMatch function not registered")
        .call(vec![input, lit(pattern)])
}

/// Return an Expr that invokes a InfluxRPC compatible regex match to
/// determine which values do not satisfy the pattern. Equivalent to:
///
/// ```text
/// col !~ /pattern/
/// ```
pub fn regex_not_match_expr(input: Expr, pattern: String) -> Expr {
    registry()
        .udf(regex::REGEX_NOT_MATCH_UDF_NAME)
        .expect("NotRegexMatch function not registered")
        .call(vec![input, lit(pattern)])
}

/// Create a DataFusion `Expr` that invokes `window_bounds` with the
/// appropriate every and offset arguments at runtime

View on GitHub (pinned to 06200ef96b)