{"record":{"id":"df772022e556a991","repo":"FuelLabs/sway","slug":"failed-to-parse-manifest","errorCode":null,"errorMessage":"failed to parse manifest: {}.","messagePattern":"failed to parse manifest: (.+?)\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"forc-pkg/src/manifest/mod.rs","lineNumber":691,"sourceCode":"    /// Given a path to a `Forc.toml`, read it and construct a `PackageManifest`.\n    ///\n    /// This also `validate`s the manifest, returning an `Err` in the case that invalid names,\n    /// fields were used.\n    ///\n    /// If `std` is unspecified, `std` will be added to the `dependencies` table\n    /// implicitly. In this case, the git tag associated with the version of this crate is used to\n    /// specify the pinned commit at which we fetch `std`.\n    pub fn from_string(contents: String) -> Result<Self> {\n        // While creating a `ManifestFile` we need to check if the given path corresponds to a\n        // package or a workspace. While doing so, we should be printing the warnings if the given\n        // file parses so that we only see warnings for the correct type of manifest.\n        let mut warnings = vec![];\n        let toml_de = toml::de::Deserializer::new(&contents);\n        let mut manifest: Self = serde_ignored::deserialize(toml_de, |path| {\n            let warning = format!(\"unused manifest key: {path}\");\n            warnings.push(warning);\n        })\n        .map_err(|e| anyhow!(\"failed to parse manifest: {}.\", e))?;\n        for warning in warnings {\n            println_warning(&warning);\n        }\n        manifest.implicitly_include_std_if_missing();\n        manifest.implicitly_include_default_build_profiles_if_missing();\n        manifest.validate()?;\n        Ok(manifest)\n    }\n\n    /// Validate the `PackageManifest`.\n    ///\n    /// This checks:\n    /// 1. The project and organization names against a set of reserved/restricted keywords and patterns.\n    /// 2. The validity of the details provided. Makes sure that there are no mismatching detail\n    ///    declarations (to prevent mixing details specific to certain types).\n    /// 3. The dependencies listed does not have an alias (\"package\" field) that is the same as package name.\n    pub fn validate(&self) -> Result<()> {\n        validate_project_name(&self.project.name)?;","sourceCodeStart":673,"sourceCodeEnd":709,"githubUrl":"https://github.com/FuelLabs/sway/blob/47e5e902faa42baf652dd6a0c88cd23390c1a614/forc-pkg/src/manifest/mod.rs#L673-L709","documentation":"Thrown by PackageManifestFile::from_string when the contents of a package-level Forc.toml cannot be deserialized into a PackageManifest with toml::de::Deserializer + serde_ignored. The {} is the underlying toml/serde error and includes the exact line/column and the expected vs found type. It fires on invalid TOML syntax or on values that do not match the manifest schema (wrong type, missing required field, wrong table shape). Note that merely unknown keys do NOT trigger this (they only produce 'unused manifest key' warnings); a parse error means structure/type problems.","triggerScenarios":"Calling PackageManifestFile::from_string(contents) (or forc CLI loading a package Forc.toml) where: [project] name = 123 (string expected), the [project] table is missing entirely, a dependency entry uses a field type the schema rejects (e.g. git = true), duplicate TOML keys exist, or a bracket/inline-table is malformed.","commonSituations":"Hand-editing Forc.toml and introducing a typo; copy-pasting a dependency block from docs of a different forc version; writing YAML-style syntax into a TOML file; using [package] instead of [project]; a merge conflict resolution that leaves broken TOML.","solutions":["Read the serde error: it names the offending key with line/column - fix that exact spot first.","Verify the file is syntactically valid TOML (e.g. taplo lint or toml::from_str::<toml::Value>) before blaming schema fields.","Check field types against the forc manifest docs for your forc version (name/entry/authors are strings, dependencies are tables).","If unsure, scaffold with 'forc init' and re-apply your changes incrementally until the error reappears."],"exampleFix":"# Forc.toml - before (name is not a string)\n[project]\nname = 123\nentry = \"main.sw\"\n\n# after\n[project]\nname = \"my_contract\"\nentry = \"main.sw\"","handlingStrategy":"validation","validationCode":"fn precheck_manifest(contents: &str) -> Result<(), String> {\n    let v: toml::Value = toml::from_str(contents).map_err(|e| format!(\"invalid TOML: {e}\"))?;\n    let name = v.get(\"project\").and_then(|p| p.get(\"name\")).and_then(|n| n.as_str());\n    if name.is_none() {\n        return Err(\"[project] table missing or 'name' is not a string\".into());\n    }\n    Ok(())\n}\n// run before PackageManifestFile::from_string","typeGuard":null,"tryCatchPattern":"match PackageManifestFile::from_string(contents) {\n    Ok(m) => { /* ... */ }\n    Err(e) => eprintln!(\"Forc.toml is invalid; fix the reported line/column: {e:#}\"),\n}","preventionTips":["Lint Forc.toml in CI (e.g. taplo fmt --check) to catch syntax errors before builds.","Treat unknown keys as suspicious but remember they only warn; type errors are what abort parsing.","Scaffold new manifests with 'forc init' instead of copying from other projects."],"tags":["toml","manifest","forc","parsing","sway"],"backgroundTag":null,"analyzedSha":"47e5e902faa42baf652dd6a0c88cd23390c1a614","analyzedAt":"2026-08-16T07:57:45.555Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}