# error[E0583]: file not found for module `module_name`

- **ID:** `rust/e0583-file-not-found-for-module`
- **Domain:** rust
- **Category:** build_error
- **Error Code:** `E0583`
- **Verification:** ai_generated
- **Fix Rate:** 95%

## Root Cause

Rust cannot find the source file for a declared module, either because the file path is incorrect, the file extension is wrong, or the module is not properly declared in `mod.rs` or `lib.rs`.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| rustc 1.68.0 | active | — | — |
| rustc 1.70.0 | active | — | — |
| rustc 1.74.0 | active | — | — |

## Workarounds

1. **Ensure the module file is created with the correct name and path: for `mod module_name;` in `src/lib.rs`, create `src/module_name.rs`.** (95% success)
   ```
   Ensure the module file is created with the correct name and path: for `mod module_name;` in `src/lib.rs`, create `src/module_name.rs`.
   ```
2. **If the module has submodules, create a directory `src/module_name/` with a `mod.rs` file inside.** (90% success)
   ```
   If the module has submodules, create a directory `src/module_name/` with a `mod.rs` file inside.
   ```
3. **Check for typos in the `mod` declaration and the file name, ensuring they match exactly (case-sensitive).** (85% success)
   ```
   Check for typos in the `mod` declaration and the file name, ensuring they match exactly (case-sensitive).
   ```

## Dead Ends

- **** — Rust expects module files to follow a specific naming convention based on the `mod` declaration; wrong placement won't be recognized. (50% fail)
- **** — Rustc only recognizes `.rs` files for module declarations; other extensions are ignored. (40% fail)
