DioxusLabs/dioxus · error

Resource is not ready

Error message

Resource is not ready

What it means

A Resource-backed value was accessed before its future resolved — the underlying Option was still None. This guard in the resource helpers indicates the async task producing the value has not completed yet.

Solutions

  1. The resource is still pending. Check its state before unwrapping: match on the resource value or use read_unchecked only after it resolves.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/hooks/src/use_resource.rs:461 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/88a0e8023ca8dced. Report an issue: GitHub.

Appendix: source

Thrown at packages/hooks/src/use_resource.rs:461

            _ => Ok(self.value.map(|v| v.as_ref().unwrap())),
        }
    }
}

impl<T, E> Resource<Result<T, E>> {
    /// Convert the `Resource<Result<T, E>>` into an `Option<Result<MappedSignal<T>, MappedSignal<E>>>`
    #[allow(clippy::type_complexity)]
    pub fn result(
        &self,
    ) -> Option<
        Result<
            MappedSignal<T, Signal<Option<Result<T, E>>>>,
            MappedSignal<E, Signal<Option<Result<T, E>>>>,
        >,
    > {
        let value: MappedSignal<T, Signal<Option<Result<T, E>>>> = self.value.map(|v| match v {
            Some(Ok(res)) => res,
            _ => panic!("Resource is not ready"),
        });

        let error: MappedSignal<E, Signal<Option<Result<T, E>>>> = self.value.map(|v| match v {
            Some(Err(err)) => err,
            _ => panic!("Resource is not ready"),
        });

        match &*self.value.peek() {
            Some(Ok(_)) => Some(Ok(value)),
            Some(Err(_)) => Some(Err(error)),
            None => None,
        }
    }
}

impl<T> From<Resource<T>> for ReadSignal<Option<T>> {
    fn from(val: Resource<T>) -> Self {
        val.value.into()

View on GitHub (pinned to 24f6a829df)