influxdata/influxdb · error · BindParameterError
Bind parameter ' ' was referenced in the InfluxQL statement…
Error message
Bind parameter '{0}' was referenced in the InfluxQL statement but its value is undefined. What it means
`BindParameterError::NotDefined` is raised when the InfluxQL statement contains a bind parameter placeholder but the user did not provide a value for it. Substitution cannot complete because the referenced parameter is undefined, so the library fails the query preparation with this error naming the missing parameter.
Solutions
- Supply a value for the named placeholder in the parameters map.
- If the predicate is optional, rewrite the statement to drop the placeholder when the value is absent.
- Validate placeholder coverage: extract all placeholders from the statement and assert every one has a value before executing.
- Review query templates for placeholders that are no longer populated by the calling code.
Example fix
// before
// query: SELECT * FROM cpu WHERE host = $host
let params: Vec<(&str, Value)> = vec![]; // $host undefined
// after
let params: Vec<(&str, Value)> = vec![("host", json!("server01"))]; Defensive patterns
Strategy: validation
Validate before calling
let missing: Vec<_> = placeholders_in_statement
.iter()
.filter(|p| !params.iter().any(|(k, _)| k == *p))
.collect();
if !missing.is_empty() { return Err(format!("missing bind parameters: {missing:?}")); } Try / catch
match bind_result {
Err(BindParameterError::NotDefined(name)) => {
return Err(anyhow!("provide a value for parameter '{name}' or drop its predicate"));
}
other => other,
} Prevention
- Build the query and its parameter map together so placeholders always have values
- Strip optional predicates from the SQL text when their values are absent
- Validate template queries against the parameters each caller supplies
When it happens
Trigger: Executing an InfluxQL statement containing a placeholder (e.g. `$host`) while the supplied parameter set omits that key, via the bind-parameter replacement API in parameter.rs.
Common situations: Conditionally building a parameter map where one optional value was skipped but the query still references it; copying a query template with more placeholders than the caller fills; user-supplied queries with placeholders not accounted for by the application.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Bind parameter ' ' was provided but not found in the…
- Parameter type ' ' is not supported by InfluxQL
- a supported service limit value is required
- Unsupported InfluxQL data type
- is not a valid data type, values are int64, uint64…
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/719933ccd3bda27b.
Report an issue: GitHub.
Appendix: source
Thrown at core/influxdb_influxql_parser/src/parameter.rs:45
use nom::multi::many1_count;
use nom::sequence::preceded;
use std::fmt;
use std::fmt::{Display, Formatter, Write};
#[derive(Debug, Clone, Error)]
/// Errors that occur during bind parameter replacement
pub enum BindParameterError {
/// Error that occurs when the user provides a parameter value
/// whose type is not supported by InfluxQL.
#[error("Parameter type '{0}' is not supported by InfluxQL")]
TypeNotSupported(String),
/// Error that occurs when the user provides a parameter value that
/// was not found within the query/statement.
#[error("Bind parameter '{0}' was provided but not found in the InfluxQL statement")]
NotFound(String),
/// Error that occurs when a query contains a bind parameter placeholder
/// but the corresponding parameter value was not provided by the user.
#[error(
"Bind parameter '{0}' was referenced in the InfluxQL statement but its value is undefined."
)]
NotDefined(String),
}
/// Parse an unquoted InfluxQL bind parameter.
fn unquoted_parameter(i: &str) -> ParseResult<&str, &str> {
recognize(many1_count(alt((alphanumeric1, tag("_"))))).parse(i)
}
/// A type that represents an InfluxQL bind parameter.
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub struct BindParameter(pub(crate) String);
impl_tuple_clause!(BindParameter, String);
impl From<&str> for BindParameter {
fn from(s: &str) -> Self {View on GitHub (pinned to 06200ef96b)