DioxusLabs/dioxus · error
Css module file ` ` should end with a `.css` suffix.
Error message
Css module file `{}` should end with a `.css` suffix. What it means
Guard in process_css_module when strip_suffix(".css") fails, i.e. the asset passed to the CSS module pipeline does not end with a `.css` extension. The faulting input is the source path; CSS module assets must be named *.css for the hash-name scheme to work.
Solutions
- CSS module files must end with .css. Rename the file with a .css suffix.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/cli/src/opt/css.rs:65 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of DioxusLabs/dioxus@24f6a829df (2026-08-23).
Data as JSON: /api/errors/8ab7d01eb50740f3.
Report an issue: GitHub.
Appendix: source
Thrown at packages/cli/src/opt/css.rs:65
css_options: &CssModuleAssetOptions,
source: &Path,
output_path: &Path,
) -> anyhow::Result<()> {
let css = std::fs::read_to_string(source)?;
// Collect the file hash name.
let mut src_name = source
.file_name()
.and_then(|x| x.to_str())
.ok_or_else(|| {
anyhow!(
"Failed to read name of css module file `{}`.",
source.display()
)
})?
.strip_suffix(".css")
.ok_or_else(|| {
anyhow!(
"Css module file `{}` should end with a `.css` suffix.",
source.display(),
)
})?
.to_string();
src_name.push('-');
let hash = create_module_hash(source);
let css = transform_css(css.as_str(), hash.as_str()).map_err(|error| {
anyhow!(
"Invalid css for file `{}`\nError:\n{}",
source.display(),
error
)
})?;
// Minify CSSView on GitHub (pinned to 24f6a829df)