pola-rs/polars · error
NAMED FUNCTION NOT FOUND
Error message
NAMED FUNCTION NOT FOUND
What it means
The registry is installed but get_function(&name, payload) returned None for the requested name: the serialized expression references a named column UDF that this process's registry does not know. The expect then panics with 'NAMED FUNCTION NOT FOUND'.
Source
Thrown at crates/polars-plan/src/dsl/expr/anonymous/expr.rs:184
pub fn materialize(self) -> PolarsResult<SpecialEq<Arc<dyn AnonymousColumnsUdf>>> {
match self {
Self::Deserialized(t) => Ok(t),
Self::Named {
name,
payload,
value,
} => feature_gated!("serde", {
use super::named_serde::NAMED_SERDE_REGISTRY_EXPR;
match value {
Some(v) => Ok(v),
None => Ok(SpecialEq(
NAMED_SERDE_REGISTRY_EXPR
.read()
.unwrap()
.as_ref()
.expect("NAMED EXPR REGISTRY NOT SET")
.get_function(&name, payload.unwrap().as_ref())
.expect("NAMED FUNCTION NOT FOUND"),
)),
}
}),
Self::Bytes(_b) => {
feature_gated!("serde";"python", {
serde_expr::deserialize_column_udf(_b.as_ref()).map(SpecialEq::new)
})
},
}
}
}
View on GitHub (pinned to df599052da)
Solutions
- Register the named function in the consumer's ExprRegistry (exact name and payload format)
- Verify producer and consumer agree on UDF names — treat UDF names as a compatibility contract
- Load the owning plugin/extension before deserializing
- If unknown names are expected, handle them before deserialization (e.g. inspect the payload) since the lookup currently panics rather than erroring
Example fix
// before: 'my_window_udf' unknown on consumer -> panic 'NAMED FUNCTION NOT FOUND'
// after: consumer registry maps every producer name
impl ExprRegistry for Reg {
fn get_function(&self, name: &str, payload: &[u8]) -> Option<Arc<dyn AnonymousColumnsUdf>> {
match name {
"my_window_udf" => Some(Arc::new(MyWindowUdf::decode(payload))),
_ => None,
}
}
}
set_named_serde_registry(Arc::new(Reg) as _); Defensive patterns
Strategy: validation
Validate before calling
for name in producer_function_names() {
assert!(registry.get_function(name, &[]).is_some(), "function {name} not registered");
} Try / catch
std::panic::catch_unwind(|| deserialize(bytes))
.map_err(|_| format!("plan references a UDF unknown to this build")) Prevention
- Register the full UDF name set on every node
- Guard UDF renames with compat aliases
- Verify plugin load order before deserialization
When it happens
Trigger: Consumer registry lacks the name the producer used — renamed/removed UDFs between versions, plugin not loaded, typo in the registered name, or a malicious/corrupted payload naming an arbitrary function.
Common situations: Version skew during rolling deploys, partial plugin installs, deserializing plans on machines that never loaded the extension providing the function.
Related errors
- NAMED AGG NOT FOUND
- NAMED EXPR REGISTRY NOT SET
- NAMED EXPR REGISTRY NOT SET
- not implemented
- not implemented
AI-assisted analysis of pola-rs/polars@df599052da (2026-08-16).
Data as JSON: /api/errors/8edd73929f8e46d6.
Report an issue: GitHub.