{"record":{"id":"b02597f7cb284b08","repo":"pola-rs/polars","slug":"activate-one-of-dtype-date-dtype-datetime","errorCode":null,"errorMessage":"activate one of {{'dtype-date', 'dtype-datetime', dtype-time'}} features","messagePattern":"activate one of (.+?)\\} features","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-io/src/csv/read/schema_inference.rs","lineNumber":369,"sourceCode":"                        Pattern::DatetimeYMD | Pattern::DatetimeDMY => {\n                            DataType::Datetime(TimeUnit::Microseconds, None)\n                        },\n                        Pattern::DateYMD | Pattern::DateDMY => DataType::Date,\n                        Pattern::DatetimeYMDZ => {\n                            DataType::Datetime(TimeUnit::Microseconds, Some(TimeZone::UTC))\n                        },\n                        Pattern::Time => DataType::Time,\n                    },\n                    None => DataType::String,\n                }\n            }\n            #[cfg(not(any(\n                feature = \"dtype-date\",\n                feature = \"dtype-datetime\",\n                feature = \"dtype-time\"\n            )))]\n            {\n                panic!(\"activate one of {{'dtype-date', 'dtype-datetime', dtype-time'}} features\")\n            }\n        } else {\n            DataType::String\n        }\n    }\n    // match regex in a particular order\n    else if BOOLEAN_RE.is_match(string) {\n        DataType::Boolean\n    } else if !decimal_comma && FLOAT_RE.is_match(string)\n        || decimal_comma && FLOAT_RE_DECIMAL.is_match(string)\n    {\n        DataType::Float64\n    } else if INTEGER_RE.is_match(string) {\n        if string.parse::<i64>().is_ok() {\n            DataType::Int64\n        } else {\n            #[cfg(feature = \"dtype-i128\")]\n            {","sourceCodeStart":351,"sourceCodeEnd":387,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/crates/polars-io/src/csv/read/schema_inference.rs#L351-L387","documentation":"This compile-time-feature panic occurs when Polars' CSV schema inference encounters a date/time-typed field (e.g. a parsed temporal column) while none of the features dtype-date, dtype-datetime, or dtype-time were enabled at build time. The inference code panics because it cannot represent the inferred temporal type without those features. It is a build-configuration problem, not a data problem.","triggerScenarios":"Calling read_csv / infer schema on CSV data whose columns resolve to a date/datetime/time type (infer_field_schema, reached via infer_types_from_line or hive_partitions_from_paths) with a polars build that has all three of those cargo features disabled.","commonSituations":"Installing polars with a minimal feature set (e.g. polars-io or polars-lazy with only csv feature) and then reading CSVs containing date-like columns; building from source with `--no-default-features`; trimming dependencies for size and dropping temporal features.","solutions":["Re-add the temporal features: use the polars crate with features [\"dtype-date\", \"dtype-datetime\", \"dtype-time\"] (or at minimum the ones you need)","If using polars-labs/polars prebuilt wheels, install the full 'polars' package rather than a slimmed variant","As a workaround, prevent temporal inference (e.g. pass explicit dtypes or set infer_schema_length=0 / try_parse_dates=false) so columns fall back to String"],"exampleFix":"// before (Cargo.toml)\npolars = { version = \"0.46\", default-features = false, features = [\"csv\"] }\n// after\npolars = { version = \"0.46\", default-features = false, features = [\"csv\", \"dtype-date\", \"dtype-datetime\", \"dtype-time\"] }","handlingStrategy":"fallback","validationCode":"// Rust build check: verify features before reading temporal CSV columns\n#[cfg(not(any(feature = \"dtype-date\", feature = \"dtype-datetime\", feature = \"dtype-time\")))]\ncompile_error!(\"CSV temporal inference requires one of dtype-date/dtype-datetime/dtype-time\");","typeGuard":"fn temporal_features_enabled() -> bool {\n    cfg!(any(feature = \"dtype-date\", feature = \"dtype-datetime\", feature = \"dtype-time\"))\n}","tryCatchPattern":"// panic!() is not catchable via Result; guard with catch_unwind only as last resort\nlet result = std::panic::catch_unwind(|| read_csv(path));\nmatch result { Err(_) => eprintln!(\"build lacks temporal dtype features; re-add them\"), Ok(df) => use(df) }","preventionTips":["When trimming cargo features, always keep the temporal dtype features you need","Prefer the full 'polars' package over hand-picked minimal features when reading CSVs","Pass explicit dtypes/schemas to read_csv to bypass temporal inference on minimal builds","Add a compile_error!/CI check for feature combinations your data requires"],"tags":["cargo-features","csv","schema-inference","polars"],"backgroundTag":"feature-not-enabled","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}