DioxusLabs/dioxus · error
Failed to read index.html from public directory
Error message
Failed to read index.html from public directory
What it means
`ServeConfig::new` reads `index.html` from the public directory when it exists; this error fires if the file exists but cannot be read (permissions, IO failure). It is an anyhow context error — the unreadable index.html in the public dir is at fault.
Solutions
- Ensure a readable index.html exists in the public directory configured for the fullstack server, or fix the configured public directory path.
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at packages/fullstack-server/src/config.rs:61 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/6c5e1327f5cc89e5.
Report an issue: GitHub.
Appendix: source
Thrown at packages/fullstack-server/src/config.rs:61
/// Create a new ServeConfig with incremental static generation disabled and the default index.html settings.
pub fn builder() -> Self {
Self::new()
}
/// Create a new ServeConfig with incremental static generation disabled and the default index.html settings
///
/// This will automatically use the `index.html` file in the `/public` directory if it exists.
/// The `/public` folder is meant located next to the current executable. If no `index.html` file is found,
/// a default index.html will be used, which will not include any JavaScript or WASM initialization code.
///
/// To provide an alternate `index.html`, you can use `with_index_html` method instead.
pub fn new() -> Self {
let index = if let Some(public_path) = crate::public_path() {
let index_html_path = public_path.join("index.html");
if index_html_path.exists() {
let index_html = std::fs::read_to_string(index_html_path)
.expect("Failed to read index.html from public directory");
IndexHtml::new(&index_html, "main")
.expect("Failed to parse index.html from public directory")
} else {
IndexHtml::ssr_only()
}
} else {
tracing::warn!(
"Cannot identify public directory, using default index.html. If you need client-side scripts (like JS + WASM), please provide an explicit public directory."
);
IndexHtml::ssr_only()
};
Self {
index,
incremental: None,
context_providers: Default::default(),
streaming_mode: StreamingMode::default(),View on GitHub (pinned to 24f6a829df)