{"record":{"id":"a5133060dd8a8bc6","repo":"DioxusLabs/dioxus","slug":"failed-to-read-name-of-css-module-file","errorCode":null,"errorMessage":"Failed to read name of css module file `{}`.","messagePattern":"Failed to read name of css module file `(.+?)`\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/opt/css.rs","lineNumber":58,"sourceCode":"        )\n    })?;\n\n    Ok(())\n}\n\npub(crate) fn process_css_module(\n    css_options: &CssModuleAssetOptions,\n    source: &Path,\n    output_path: &Path,\n) -> anyhow::Result<()> {\n    let css = std::fs::read_to_string(source)?;\n\n    // Collect the file hash name.\n    let mut src_name = source\n        .file_name()\n        .and_then(|x| x.to_str())\n        .ok_or_else(|| {\n            anyhow!(\n                \"Failed to read name of css module file `{}`.\",\n                source.display()\n            )\n        })?\n        .strip_suffix(\".css\")\n        .ok_or_else(|| {\n            anyhow!(\n                \"Css module file `{}` should end with a `.css` suffix.\",\n                source.display(),\n            )\n        })?\n        .to_string();\n\n    src_name.push('-');\n\n    let hash = create_module_hash(source);\n    let css = transform_css(css.as_str(), hash.as_str()).map_err(|error| {\n        anyhow!(","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/cli/src/opt/css.rs#L40-L76","documentation":"Guard in process_css_module when source.file_name() returns None or a non-UTF-8 OsStr, so no module name can be derived for hashing. The input at fault is the CSS module asset path; a valid .css module file always has a UTF-8 file name.","triggerScenarios":"Thrown at packages/cli/src/opt/css.rs:58 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The CSS module file name could not be read. Give the file a valid UTF-8 name."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"24f6a829df0dfa203961a98ea4cae21c2ff27e28","analyzedAt":"2026-08-23T07:10:14.078Z","contentChangedAt":"2026-08-23T07:10:14.078Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}