{"record":{"id":"8ff9fcdfdd91f7d1","repo":"FuelLabs/sway","slug":"dependency-of-named-is-invalid","errorCode":null,"errorMessage":"dependency of {:?} named {:?} is invalid: {}","messagePattern":"dependency of (.+?) named (.+?) is invalid: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"forc-pkg/src/pkg.rs","lineNumber":1526,"sourceCode":"                added.insert(dep_node);\n                *entry.insert(dep_node)\n            }\n        };\n\n        let dep_edge = Edge::new(dep_name.to_string(), dep_kind.clone());\n        // Ensure we have an edge to the dependency.\n        graph.update_edge(node, dep_node, dep_edge.clone());\n\n        // If we've visited this node during this traversal already, no need to traverse it again.\n        if !visited.insert(dep_node) {\n            continue;\n        }\n\n        let dep_pinned = &graph[dep_node];\n        let dep_pkg_id = dep_pinned.id();\n        validate_dep_manifest(dep_pinned, &manifest_map[&dep_pkg_id], &dep_edge).map_err(|e| {\n            let parent = &graph[node];\n            anyhow!(\n                \"dependency of {:?} named {:?} is invalid: {}\",\n                parent.name,\n                dep_name,\n                e\n            )\n        })?;\n\n        let path_root = match dep_pinned.source {\n            source::Pinned::Member(_)\n            | source::Pinned::Git(_)\n            | source::Pinned::Ipfs(_)\n            | source::Pinned::Registry(_) => dep_pkg_id,\n            source::Pinned::Path(_) => path_root,\n        };\n\n        // Fetch the children.\n        added.extend(fetch_deps(\n            fetch_id,","sourceCodeStart":1508,"sourceCodeEnd":1544,"githubUrl":"https://github.com/FuelLabs/sway/blob/47e5e902faa42baf652dd6a0c88cd23390c1a614/forc-pkg/src/pkg.rs#L1508-L1544","documentation":"Thrown while forc walks the dependency graph during fetch/build planning: after adding an edge to a dependency node, it calls validate_dep_manifest on the dependency's manifest. If that validation fails (malformed tables, invalid entries, missing sections), the error is wrapped with the parent package name and the dependency name, so the failing edge of the graph is identified.","triggerScenarios":"Building any manifest whose dependency (path, git, ipfs, registry or workspace member) has a Forc.toml that fails validate_dep_manifest - e.g. a misspelled table key, a dependency entry missing required fields, or an invalid [project] section inside the dependency's manifest.","commonSituations":"Adding a git or path dependency whose Forc.toml is malformed or written for a different forc version; editing a workspace member's manifest while other packages depend on it; upgrading forc which tightened manifest validation rules.","solutions":["Read the tail of the message: the text after 'is invalid:' is the underlying validate_dep_manifest cause - fix that in the named dependency's Forc.toml","Verify the dependency key in [dependencies] exactly matches the [project].name inside the dependency's own Forc.toml","If the dependency comes from git/ipfs, update to a rev/tag/cid where its manifest is valid for your forc version","Re-run forc build (or forc check) from the workspace root to confirm the whole graph validates"],"exampleFix":"# dependency's Forc.toml - before\n[project]\nauthros = [\"me\"]\nname = \"my_lib\"\n\n# after\n[project]\nauthors = [\"me\"]\nname = \"my_lib\"\nentry = \"lib.sw\"","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match forc_pkg::build_with_options(&opts) {\n    Ok(built) => { /* ... */ }\n    Err(e) if e.to_string().starts_with(\"dependency of\") => {\n        // message contains parent pkg name, dep name and root cause after 'is invalid:'\n        eprintln!(\"invalid dependency manifest: {e:#}\");\n        std::process::exit(1);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Validate every dependency's Forc.toml with PackageManifestFile::from_file plus field checks before constructing a BuildPlan","Pin git dependencies to a rev you have already built successfully","Run forc check after editing manifests of workspace members"],"tags":["rust","forc","manifest","dependencies","validation"],"backgroundTag":null,"analyzedSha":"47e5e902faa42baf652dd6a0c88cd23390c1a614","analyzedAt":"2026-08-16T07:57:45.555Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}