databendlabs/databend · error
connection_name can not be used with other connection…
Error message
connection_name can not be used with other connection options
What it means
A named connection reference (connection_name) must be used alone: it cannot be combined with additional inline connection options, otherwise Databend could not decide which settings win. apply_uri_connection calls connection.check() and throws this InvalidInput error when connection_name coexists with other options.
Solutions
- Remove all other options from the CONNECTION clause, keeping only CONNECTION_NAME
- If you need overrides, create a new connection with the full set of options and reference it instead
- Inline all required options without CONNECTION_NAME if per-stage customization is needed
Example fix
-- before CREATE STAGE s URL='s3://bucket/path/' CONNECTION_NAME='c' CONNECTION=(REGION='us-east-1'); -- after CREATE STAGE s URL='s3://bucket/path/' CONNECTION_NAME='c';
Defensive patterns
Strategy: validation
Validate before calling
if opts.contains_key("connection_name") && opts.keys().any(|k| k != "connection_name") {
return Err("CONNECTION_NAME cannot be combined with other connection options".into());
} Try / catch
match err.kind() { ErrorKind::InvalidInput if msg.contains("can not be used with other connection options") => /* drop extra options or create a new connection */, _ => return Err(err) } Prevention
- Treat CONNECTION_NAME as exclusive in the CONNECTION clause
- To override settings, create a new connection with all options
- Have generators emit either all-inline options or a single CONNECTION_NAME, never both
When it happens
Trigger: STAGE ... URL='s3://bucket/' CONNECTION_NAME='c' CONNECTION=(REGION='us-east-1') or any other option alongside CONNECTION_NAME in the same CONNECTION clause.
Common situations: Trying to override one option of a named connection; tooling that appends extra options to a CONNECTION clause that already names a connection.
Related errors
- can not use connection_name when create connection
- path in URL must end with '/
- input connection is not a valid protocol
- {}
- sync crash me panic
AI-assisted analysis of databendlabs/databend@288d84d76e (2026-09-11).
Data as JSON: /api/errors/e9487212416a71c0.
Report an issue: GitHub.
Appendix: source
Thrown at src/query/sql/src/planner/binder/location.rs:579
let protocol = l.protocol.parse::<Scheme>()?;
let proto = conn.storage_type.parse::<Scheme>().map_err(|err| {
Error::new(
ErrorKind::InvalidInput,
anyhow!("input connection is not a valid protocol: {err:?}"),
)
})?;
if proto != protocol {
return Err(Error::new(
ErrorKind::InvalidInput,
anyhow!(
"protocol from connection_name={name} ({proto}) not match with uri protocol ({protocol})."
),
));
}
l.connection.check().map_err(|_| {
Error::new(
ErrorKind::InvalidInput,
anyhow!("connection_name can not be used with other connection options"),
)
})?;
l.connection = Connection::new(conn.storage_params);
Ok(())
}
async fn parse_uri_location_resolved(
l: &mut UriLocation,
parts: ParsedUriLocation,
) -> Result<(StorageParams, String)> {
let ParsedUriLocation {
root,
path,
protocol,
} = parts;
let sp = match protocol {View on GitHub (pinned to 288d84d76e)