databendlabs/databend · error
input connection is not a valid protocol
Error message
input connection is not a valid protocol: {err:?} What it means
apply_uri_connection compares the storage_type of the referenced named connection with the protocol parsed from the URI. If the connection's storage_type cannot be parsed as an OpenDAL Scheme, this InvalidInput error is thrown, meaning the stored connection has an unrecognized or invalid storage type.
Solutions
- Recreate the named connection with a valid STORAGE_TYPE (e.g. 's3','gcs','oss','azblob')
- Inspect the connection definition (SHOW CONNECTIONS / meta inspect) and fix storage_type
- Upgrade/repair legacy connections whose storage_type strings no longer parse
Example fix
-- before (invalid storage type) CREATE CONNECTION c STORAGE_TYPE='s3legacy' ...; -- after CREATE CONNECTION c STORAGE_TYPE='s3' ENDPOINT_URL='https://s3.amazonaws.com';
Defensive patterns
Strategy: validation
Validate before calling
let stored = get_connection(name)?.storage_type;
if opendal::Scheme::from_str(&stored).is_err() {
return Err(format!("connection {name} has invalid storage_type {stored:?}; recreate it"));
} Try / catch
match err.kind() { ErrorKind::InvalidInput if msg.contains("not a valid protocol") => /* recreate/repair the named connection */, _ => return Err(err) } Prevention
- Create connections only with valid STORAGE_TYPE values
- Audit old connections after version upgrades
- Validate storage_type against the Scheme enum when provisioning
When it happens
Trigger: Using CONNECTION_NAME to apply a stored connection whose storage_type string is not a valid scheme (corrupted or legacy meta record, hand-edited connection), during resolve_uri_connection.
Common situations: Connections created by older versions with scheme strings no longer parseable; corrupted meta-service records; typos in storage_type when a connection was created via API.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- path in URL must end with '/
- protocol is not supported yet.
- can not use connection_name when create connection
- protocol from connection_name=
- connection_name can not be used with other connection…
AI-assisted analysis of databendlabs/databend@288d84d76e (2026-09-11).
Data as JSON: /api/errors/b0b799234c3e80c0.
Report an issue: GitHub.
Appendix: source
Thrown at src/query/sql/src/planner/binder/location.rs:565
return Err(Error::new(
ErrorKind::InvalidInput,
anyhow!("can not use connection_name when create connection"),
));
}
parse_uri_location_resolved(l, parts).await
}
pub fn apply_uri_connection(
l: &mut UriLocation,
name: &str,
conn: UserDefinedConnection,
) -> Result<()> {
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);
View on GitHub (pinned to 288d84d76e)