{"record":{"id":"fda422e2d13556a7","repo":"FuelLabs/sway","slug":"failed-to-read-manifest-at","errorCode":null,"errorMessage":"failed to read manifest at {:?}: {}","messagePattern":"failed to read manifest at (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"forc-pkg/src/manifest/mod.rs","lineNumber":669,"sourceCode":"\nimpl PackageManifest {\n    pub const DEFAULT_ENTRY_FILE_NAME: &'static str = \"main.sw\";\n\n    /// 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_file<P: AsRef<Path>>(path: P) -> 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 path = path.as_ref();\n        let contents = std::fs::read_to_string(path)\n            .map_err(|e| anyhow!(\"failed to read manifest at {:?}: {}\", path, e))?;\n        Self::from_string(contents)\n    }\n\n    /// 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| {","sourceCodeStart":651,"sourceCodeEnd":687,"githubUrl":"https://github.com/FuelLabs/sway/blob/47e5e902faa42baf652dd6a0c88cd23390c1a614/forc-pkg/src/manifest/mod.rs#L651-L687","documentation":"PackageManifestFile::from_file reads Forc.toml with fs::read_to_string and on failure reports the exact path and OS error. It covers missing files, permission errors, path-is-a-directory, and non-UTF-8 content; it is raised before any TOML parsing, so syntax problems surface later in from_string with different messages.","triggerScenarios":"Invoking forc (or any API that locates and loads a manifest - builds, forc add/remove, BuildPlan construction) where the Forc.toml path does not exist, is not a regular readable file, or is not valid UTF-8.","commonSituations":"Running forc build outside the project root; a wrong --manifest-path; CI checkouts that skipped the file; a manifest saved with a BOM or non-UTF-8 encoding by an editor; deleted or renamed manifest.","solutions":["Run the command from (or point --manifest-path at) the directory that actually contains Forc.toml.","If starting a new project, create the manifest first with forc init.","Ensure the file is UTF-8 encoded (no BOM/binary bytes) and readable by the current user."],"exampleFix":"# before\n$ cd packages/inner && forc build --manifest-path ./Forc.toml\nerror: failed to read manifest at \"./Forc.toml\" ...\n\n# after\n$ forc build --manifest-path ./packages/inner/Forc.toml  # path that exists","handlingStrategy":"validation","validationCode":"// Rust, before PackageManifestFile::from_file:\nuse std::fs;\nfn manifest_loadable(p: &std::path::Path) -> bool {\n    fs::metadata(p).map(|m| m.is_file()).unwrap_or(false)\n        && fs::read(p).map(|b| String::from_utf8(b).is_ok()).unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"// anyhow Result - separate missing-file from other failures:\nmatch PackageManifestFile::from_file(&path) {\n    Ok(m) => m,\n    Err(e) if e.to_string().contains(\"failed to read manifest\") =>\n        panic!(\"no readable Forc.toml at {} - run in the project root or pass --manifest-path\", path.display()),\n    Err(e) => panic!(\"manifest invalid: {e}\"),\n}","preventionTips":["Run forc commands from the directory containing Forc.toml, or pass --manifest-path.","Start projects with forc init so a valid manifest exists.","Keep Forc.toml as UTF-8 without BOM; check encodings after cross-platform edits.","Script CI to verify the manifest exists before invoking build steps."],"tags":["forc","manifest","io","cli"],"backgroundTag":null,"analyzedSha":"47e5e902faa42baf652dd6a0c88cd23390c1a614","analyzedAt":"2026-08-16T07:57:45.555Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}