databendlabs/databend · error · InvalidInput

name_node in uri( ) and from connection option 'name_node'(…

Error message

name_node in uri({n2}) and from connection option 'name_node'({n1}) not match.

What it means

When binding a location URI with the hdfs:// scheme, Databend parses the name node from the URI and also accepts a 'name_node' connection option. If both are present and their values differ, parse_hdfs_params rejects the statement because it cannot decide which name node is authoritative. This prevents silently reading from a different HDFS cluster than the one the user configured.

Solutions

  1. Make the name_node value in the connection options exactly match the host:port in the hdfs:// URI (string equality is required).
  2. Remove the redundant 'name_node' connection option and rely solely on the URI.
  3. Remove the host:port from the URI and specify it only via the name_node option.
  4. Check for case, whitespace, or default-port differences (e.g. hdfs://nn:8020/ vs hdfs://nn/) that make values differ.

Example fix

// before
CREATE STAGE s URL = 'hdfs://nn1:8020/data/' CONNECTION = (name_node = 'nn2:8020');
// after
CREATE STAGE s URL = 'hdfs://nn1:8020/data/' CONNECTION = (name_node = 'nn1:8020');
Defensive patterns

Strategy: validation

Validate before calling

// Rust
if let (Some(opt), Some(uri_nn)) = (conn_opts.get("name_node"), uri_host_port) {
    assert_eq!(opt, &uri_nn, "name_node option must match hdfs URI authority");
}

Prevention

When it happens

Trigger: Executing CREATE STAGE / location-based COPY with a URI like 'hdfs://nn1:8020/path' while the connection options also include name_node='nn2:8020' (any mismatched value, including differing port or host spelling).

Common situations: Copy-pasting a stage definition where the URI was updated but the options block still holds an old name_node; templated configs substituting different cluster hosts into URI and options; trailing-slash or port differences that make the strings unequal though they point at the same cluster.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of databendlabs/databend@288d84d76e (2026-09-11). Data as JSON: /api/errors/73d91103a12969e4. Report an issue: GitHub.

Appendix: source

Thrown at src/query/sql/src/planner/binder/location.rs:375

}

/// Generally, the URI is in the pattern hdfs://<namenode>/<path>.
/// If <namenode> is empty (i.e. `hdfs:///<path>`),  use <namenode> configured somewhere else, e.g. in XML config file.
/// For databend user can specify <namenode> in connection options.
/// refer to https://www.vertica.com/docs/9.3.x/HTML/Content/Authoring/HadoopIntegrationGuide/libhdfs/HdfsURL.htm
#[cfg(feature = "storage-hdfs")]
fn parse_hdfs_params(l: &mut UriLocation, root: String) -> Result<StorageParams> {
    let name_node_from_uri = if l.name.is_empty() {
        None
    } else {
        Some(format!("hdfs://{}", l.name))
    };
    let name_node_option = l.connection.get("name_node");

    let name_node = match (name_node_option, name_node_from_uri) {
        (Some(n1), Some(n2)) => {
            if n1 != &n2 {
                return Err(Error::new(
                    ErrorKind::InvalidInput,
                    format!(
                        "name_node in uri({n2}) and from connection option 'name_node'({n1}) not match."
                    ),
                ));
            } else {
                n2
            }
        }
        (Some(n1), None) => n1.to_string(),
        (None, Some(n2)) => n2,
        (None, None) => {
            // we prefer user to specify name_node in options
            return Err(Error::new(
                ErrorKind::InvalidInput,
                "name_node is required for storage hdfs",
            ));
        }

View on GitHub (pinned to 288d84d76e)