pola-rs/polars · error
Feature `cloud` must be enabled to use globbing patterns…
Error message
Feature `cloud` must be enabled to use globbing patterns with cloud urls.
What it means
expand_paths_hive panics when a globbing pattern (e.g. s3://bucket/data/*.parquet) is used with a cloud URL but the polars 'cloud' feature is disabled, since cloud path expansion requires that feature. The library deliberately aborts instead of silently mis-expanding.
Solutions
- Enable the cloud feature: polars = { version = "...", features = ["cloud"] } in Cargo.toml.
- Remove the wildcard and pass explicit object paths instead (list files yourself via the cloud SDK).
- Use local paths for globbing if cloud access is not actually required.
Example fix
// before
polars = { version = "0.46", features = ["lazy"] }
// after
polars = { version = "0.46", features = ["lazy", "cloud"] } Defensive patterns
Strategy: validation
Validate before calling
fn is_cloud_glob(path: &str) -> bool {
(path.starts_with("s3://") || path.starts_with("gs://") || path.starts_with("az://") || path.starts_with("azure://"))
&& path.chars().any(|c| c == '*' || c == '?' || c == '[')
}
assert!(!paths.iter().any(is_cloud_glob), "cloud globbing needs the 'cloud' feature"); Try / catch
// It's a panic, not a Result; pre-validate inputs before calling expand_paths
if is_cloud_glob(&url) {
// list objects via cloud SDK instead, or compile with the cloud feature
} Prevention
- Enable features = ["cloud"] whenever any scan path may point at object storage
- Enumerate cloud object lists with the SDK and pass explicit paths when globbing isn't available
- Add a startup check that maps intended inputs to required features in CI
When it happens
Trigger: Calling expand_paths / expand_paths_hive (directly or via scan/read functions) with a glob pattern in a cloud scheme URL (s3://, gs://, azure://...) on a polars build compiled without feature = "cloud".
Common situations: Using prebuilt polars wheels/binaries without the cloud feature while scanning wildcards on S3/GCS/Azure; upgrading polars and losing the feature flag in Cargo.toml.
Related errors
- activate 'decompress' feature
- activate object
- activate 'timezones' feature
- expected index type found
- timezone " " cannot be parsed (feature chrono-tz is not…
AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18).
Data as JSON: /api/errors/6797ead9d397ddc7.
Report an issue: GitHub.
Appendix: source
Thrown at crates/polars-io/src/path_utils/mod.rs:541
first_path_has_scheme,
)
.await?;
for (p, size) in paths {
if let Some(size) = size {
sizes_by_path.insert(p.clone(), size);
}
out_paths.push(p);
}
hive_idx_tracker.update(expand_start_idx, path_idx)?;
};
if let Some(mut_slice) = out_paths.paths.get_mut(sort_start_idx..) {
<[PlRefPath]>::sort_unstable(mut_slice);
}
}
}
#[cfg(not(feature = "cloud"))]
panic!("Feature `cloud` must be enabled to use globbing patterns with cloud urls.")
} else {
let mut stack: VecDeque<Cow<'_, Path>> = VecDeque::new();
let mut paths_scratch: Vec<PathBuf> = vec![];
for (path_idx, path) in paths.iter().enumerate() {
stack.clear();
let sort_start_idx = out_paths.paths.len();
if path.as_std_path().is_dir() {
let i = path.as_str().len();
hive_idx_tracker.update(i, path_idx)?;
stack.push_back(Cow::Borrowed(path.as_std_path()));
while let Some(dir) = stack.pop_front() {
let mut last_err = Ok(());
View on GitHub (pinned to fe841f959e)