FuelLabs/sway · error · anyhow::Error

Failed to canonicalize dependency path {:?}: {}

Error message

Failed to canonicalize dependency path {:?}: {}

What it means

Error "Failed to canonicalize dependency path {:?}: {}" thrown in FuelLabs/sway.

Source

Thrown at forc-pkg/src/source/mod.rs:173

    source: &'a T,
    manifest_dir: &'a Path,
}

/// Error returned upon failed parsing of `SourcePinned::from_str`.
#[derive(Clone, Debug)]
pub struct PinnedParseError;

impl Source {
    /// Construct a source from path information collected from manifest file.
    fn with_path_dependency(
        relative_path: &Path,
        manifest_dir: &Path,
        member_manifests: &MemberManifestFiles,
    ) -> Result<Self> {
        let path = manifest_dir.join(relative_path);
        let canonical_path = path
            .canonicalize()
            .map_err(|e| anyhow!("Failed to canonicalize dependency path {:?}: {}", path, e))?;
        // Check if path is a member of a workspace.
        if member_manifests
            .values()
            .any(|pkg_manifest| pkg_manifest.dir() == canonical_path)
        {
            Ok(Source::Member(member::Source(canonical_path)))
        } else {
            Ok(Source::Path(canonical_path))
        }
    }

    /// Construct a source from version information collected from manifest file.
    fn with_version_dependency(
        pkg_name: &str,
        version: &str,
        namespace: &reg::file_location::Namespace,
    ) -> Result<Self> {
        // TODO: update here once we are supporting non-exact versions (non `x.y.z` versions)

View on GitHub (pinned to 47e5e902fa)

When it happens

Trigger: Thrown at forc-pkg/src/source/mod.rs:173 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of FuelLabs/sway@47e5e902fa (2026-08-16). Data as JSON: /api/errors/2e1c4fb7ef1427f5. Report an issue: GitHub.