DioxusLabs/dioxus · error

Failed to find package {package}

Error message

Failed to find package {package}

What it means

Failure of Workspace::find_main_package after exhaustive search of workspace members: the requested package name is not a member of the current cargo workspace. Diagnostic errors listing all workspace members are logged first; the faulting input is the package name from CLI/config that must be added to the workspace.

Source

Thrown at packages/cli/src/workspace.rs:339

                        return Some(id);
                    }
                }
                None
            });

            if found.is_none() {
                tracing::error!(
                    "Could not find package {package} in the workspace. Did you forget to add it to the workspace?"
                );
                tracing::error!("Packages in the workspace:");
                for package in self.krates.workspace_members() {
                    if let krates::Node::Krate { krate, .. } = package {
                        tracing::error!("{}", krate.name());
                    }
                }
            }

            let kid = found.ok_or_else(|| anyhow::anyhow!("Failed to find package {package}"))?;

            return Ok(self.krates.nid_for_kid(kid).unwrap());
        };

        // if we have default members specified, try them first
        if let Some(ws) = &self.cargo_toml.workspace {
            for default in &ws.default_members {
                let mut workspace_members = self.krates.workspace_members();
                let default_member_path = std::fs::canonicalize(default).unwrap();

                let found = workspace_members.find_map(|node| {
                    if let krates::Node::Krate { id, krate, .. } = node {
                        // Skip this default member if it doesn't have any binary targets
                        if !krate
                            .targets
                            .iter()
                            .any(|t| t.kind.contains(&krates::cm::TargetKind::Bin))
                        {

View on GitHub (pinned to 24f6a829df)

Solutions

  1. The package was not found in the workspace. Check the package name in Cargo.toml.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/cli/src/workspace.rs:339 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/6188f9a754eb93cb. Report an issue: GitHub.