{"record":{"id":"1baa425b04b41492","repo":"bevyengine/bevy","slug":"unable-to-read-cargo-manifest","errorCode":null,"errorMessage":"Unable to read cargo manifest: {}","messagePattern":"Unable to read cargo manifest: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/bevy_macro_utils/src/bevy_manifest.rs","lineNumber":76,"sourceCode":"                assert!(\n                    path.exists(),\n                    \"Cargo manifest does not exist at path {}\",\n                    path.display()\n                );\n                path\n            })\n            .expect(\"CARGO_MANIFEST_DIR is not defined.\")\n    }\n\n    fn get_manifest_modified_time(\n        cargo_manifest_path: &Path,\n    ) -> Result<SystemTime, std::io::Error> {\n        std::fs::metadata(cargo_manifest_path).and_then(|metadata| metadata.modified())\n    }\n\n    fn read_manifest(path: &Path) -> Document<Box<str>> {\n        let manifest = std::fs::read_to_string(path)\n            .unwrap_or_else(|_| panic!(\"Unable to read cargo manifest: {}\", path.display()))\n            .into_boxed_str();\n        Document::parse(manifest)\n            .unwrap_or_else(|_| panic!(\"Failed to parse cargo manifest: {}\", path.display()))\n    }\n\n    /// Attempt to retrieve the [path](syn::Path) of a particular package in\n    /// the [manifest](BevyManifest) by [name](str).\n    pub fn maybe_get_path(&self, name: &str) -> Option<syn::Path> {\n        // Cargo normalizes hyphens to underscores when crates are referenced from Rust code.\n        let rust_name = name.replace('-', \"_\");\n        let find_in_deps = |deps: &Item| -> Option<syn::Path> {\n            let package = if deps.get(name).is_some() {\n                return Some(Self::parse_str(&rust_name));\n            } else if deps.get(BEVY).is_some() {\n                BEVY\n            } else {\n                // Note: to support bevy crate aliases, we could do scanning here to find a crate with a \"package\" name that\n                // matches our request, but that would then mean we are scanning every dependency (and dev dependency) for every","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_macro_utils/src/bevy_manifest.rs#L58-L94","documentation":"bevy_macro_utils' BevyManifest::read_manifest panics when Cargo.toml at the derived CARGO_MANIFEST_DIR path cannot be read (crates/bevy_macro_utils/src/bevy_manifest.rs:76). Bevy proc macros use this at compile time to resolve sibling crate paths, so the panic aborts compilation of any crate expanding Bevy macros.","triggerScenarios":"Compiling a crate that uses Bevy macros while its Cargo.toml is missing or unreadable mid-build: interrupted builds, sources moved/deleted during compile, sandbox/permission/antivirus locks on the manifest, or a corrupted target cache pointing at stale paths.","commonSituations":"CI cache corruption; builds on network filesystems where the manifest briefly vanishes; antivirus or sandbox tooling locking Cargo.toml; editing or moving files while cargo runs; unusual workspaces with generated manifests.","solutions":["Run cargo clean and rebuild from a quiescent, unmodified source tree.","Verify Cargo.toml exists and is readable in the failing crate's directory (check the path printed in the panic).","Allowlist the project in antivirus/sandbox tools or move off flaky network filesystems so the manifest cannot be locked or disappear during macro expansion."],"exampleFix":"// before: cargo build fails with 'Unable to read cargo manifest: .../Cargo.toml'\n\n// after\ncargo clean\ncargo build # rebuild with no concurrent edits to the source tree","handlingStrategy":"retry","validationCode":"# pre-build sanity check (CI or wrapper script):\ntest -f \"${CARGO_MANIFEST_DIR:-.}/Cargo.toml\" || {\n  echo \"Cargo.toml missing/unreadable; restore sources before building\"; exit 1;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not edit, move, or delete sources while cargo is building.","After interrupted builds, run cargo clean before rebuilding.","Allowlist the workspace in antivirus/sandbox tools so Cargo.toml is never locked.","Prefer stable local filesystems over network mounts for Bevy macro builds."],"tags":["bevy","build","proc-macro","cargo","manifest","compile-error"],"backgroundTag":"cargo-manifest-read-failure","analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-09T01:17:15.007Z"}