influxdata/influxdb · error · BindParameterError

Bind parameter ' ' was provided but not found in the…

Error message

Bind parameter '{0}' was provided but not found in the InfluxQL statement

What it means

`BindParameterError::NotFound` is raised when the user supplies a bind parameter value that no placeholder in the InfluxQL statement references. The library treats unused supplied parameters as an error so typos/mismatches between parameters and the query are surfaced instead of silently ignored.

Solutions

  1. Remove the unused parameter from the supplied map, or fix its name to match the placeholder in the statement.
  2. Diff the parameter keys against the placeholders extracted from the statement before binding.
  3. Build query text and parameters together from a shared constant to avoid name drift.
  4. Watch for case differences — parameter names must match exactly.

Example fix

// before
let params = vec![("host_name", json!("server01"))]; // stmt uses $host
// after
let params = vec![("host", json!("server01"))]; // matches $host in statement
Defensive patterns

Strategy: validation

Validate before calling

let provided: HashSet<&str> = params.iter().map(|(k, _)| *k).collect();
let extra: Vec<_> = provided.difference(&placeholders_in_statement).collect();
if !extra.is_empty() { return Err(format!("unused parameters: {extra:?}")); }

Try / catch

match bind_result {
    Err(BindParameterError::NotFound(name)) => {
        log::warn!("parameter '{name}' not in statement; check for name mismatch");
    }
    other => other,
}

Prevention

When it happens

Trigger: Calling the bind-parameter replacement API with a parameters map containing a key that does not appear as a placeholder (e.g. `$foo`/`$bar` mismatch) in the parsed InfluxQL statement.

Common situations: Renaming a placeholder in the query but not in the parameter map (or vice versa); reusing a shared parameter set across different queries; case-sensitivity mismatches in parameter names.

Understand the failure class

Background: "Invalid query parameter" / "Failed to parse value of ...": fixing bad query string parameters across APIs — this error's family across 36 libraries.

Related errors


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

Appendix: source

Thrown at core/influxdb_influxql_parser/src/parameter.rs:41

use nom::branch::alt;
use nom::bytes::complete::tag;
use nom::character::complete::{alphanumeric1, char};
use nom::combinator::{map, recognize};
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);

View on GitHub (pinned to 06200ef96b)