leptos-rs/leptos · error

You are rendering AnyView to HTML without the `ssr` feature

Error message

You are rendering AnyView to HTML without the `ssr` feature enabled.

What it means

AnyView's dry_resolve (used in server-side rendering dry runs to determine view type/branch info) delegates to an SSR-only function pointer. Without the `ssr` feature enabled, there is no implementation, so the method panics rather than silently producing wrong HTML.

Source

Thrown at tachys/src/view/any_view.rs:431

    {
        AnyViewWithAttrs {
            view: self,
            attrs: vec![attr.into_cloneable_owned().into_any_attr()],
        }
    }
}

impl RenderHtml for AnyView {
    type AsyncOutput = Self;
    type Owned = Self;

    fn dry_resolve(&mut self) {
        #[cfg(feature = "ssr")]
        {
            (self.dry_resolve)(&mut self.value)
        }
        #[cfg(not(feature = "ssr"))]
        panic!(
            "You are rendering AnyView to HTML without the `ssr` feature \
             enabled."
        );
    }

    async fn resolve(self) -> Self::AsyncOutput {
        #[cfg(feature = "ssr")]
        {
            (self.resolve)(self.value).await
        }
        #[cfg(not(feature = "ssr"))]
        panic!(
            "You are rendering AnyView to HTML without the `ssr` feature \
             enabled."
        );
    }

    const MIN_LENGTH: usize = 0;

View on GitHub (pinned to 32d20f6c9d)

Solutions

  1. Enable the `ssr` feature on leptos/tachys for the server build (cargo build --features ssr).
  2. Split server and client into separate binaries/targets with the appropriate feature flags (leptos' standard project layout).
  3. Avoid resolving AnyView to HTML in client-only builds.

Example fix

// before (Cargo.toml, server)
leptos = { version = "0.7", features = ["csr"] }
// after
leptos = { version = "0.7", features = ["ssr"] }
Defensive patterns

Strategy: validation

Validate before calling

#[cfg(not(feature = "ssr"))]
compile_error!("HTML string rendering requires the `ssr` feature"); // in server crate

Try / catch

std::panic::catch_unwind(|| any_view.dry_resolve()); // surface a feature-flag error message instead of a raw panic

Prevention

When it happens

Trigger: Calling dry_resolve on an AnyView (e.g. during SSR or resolve-to-HTML paths) in a build compiled without the `ssr` feature on tachys/leptos.

Common situations: Rendering to string on the server but the crate was built with only the csr/hydrate features; using the same binary for client and server without cfg-split features; missing `island`/`ssr` feature toggles in Cargo.toml.

Related errors


AI-assisted analysis of leptos-rs/leptos@32d20f6c9d (2026-09-01). Data as JSON: /api/errors/a528333c37d52705. Report an issue: GitHub.