{"record":{"id":"4d9d57143e5f45da","repo":"DioxusLabs/dioxus","slug":"couldn-t-read-public-directory-at","errorCode":null,"errorMessage":"Couldn't read public directory at {:?}: {}","messagePattern":"Couldn't read public directory at (.+?): (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/fullstack-server/src/server.rs","lineNumber":409,"sourceCode":"\n    // The CLI always bundles static assets into the exe/public directory\n    Some(\n        std::env::current_exe()\n            .ok()?\n            .parent()\n            .unwrap()\n            .join(\"public\"),\n    )\n}\n\nfn serve_dir_cached<S>(mut router: Router<S>, public_path: &Path, directory: &Path) -> Router<S>\nwhere\n    S: Send + Sync + Clone + 'static,\n{\n    use tower_http::services::{ServeDir, ServeFile};\n\n    let dir = std::fs::read_dir(directory)\n        .unwrap_or_else(|e| panic!(\"Couldn't read public directory at {:?}: {}\", &directory, e));\n\n    for entry in dir.flatten() {\n        let path = entry.path();\n        // Don't serve the index.html file. The SSR handler will generate it.\n        if path == public_path.join(\"index.html\") {\n            continue;\n        }\n\n        let route = format!(\n            \"/{}\",\n            path.strip_prefix(public_path)\n                .unwrap()\n                .iter()\n                .map(|segment| segment.to_string_lossy())\n                .collect::<Vec<_>>()\n                .join(\"/\")\n        );\n","sourceCodeStart":391,"sourceCodeEnd":427,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/fullstack-server/src/server.rs#L391-L427","documentation":"serve_dir_cached could not read the static assets directory (exe/public or the configured public path). std::fs::read_dir failed — typically the directory does not exist or lacks read permissions — so the fullstack server cannot mount static assets.","triggerScenarios":"Thrown at packages/fullstack-server/src/server.rs:409 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The public directory cannot be read. Create it, fix the configured path, or correct its permissions."],"exampleFix":null,"handlingStrategy":"try-catch","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-14T05:17:10.506Z"}