{"record":{"id":"d30adc4deaff6700","repo":"linera-io/linera-protocol","slug":"no-cargo-toml-found-at-the-path-must-point-to","errorCode":null,"errorMessage":"No Cargo.toml found at {}. The path must point to a Rust project directory.","messagePattern":"No Cargo\\.toml found at (.+?)\\. The path must point to a Rust project directory\\.","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"linera-service/src/project.rs","lineNumber":94,"sourceCode":"        debug!(\"Writing service.rs\");\n        Self::create_service_file(&source_directory, name)?;\n\n        debug!(\"Writing single_chain.rs\");\n        Self::create_test_file(&test_directory, name)?;\n\n        Ok(Self { root })\n    }\n\n    /// Opens an existing application project at the given root directory.\n    pub fn from_existing_project(root: &Path) -> Result<Self> {\n        let root = root.canonicalize().with_context(|| {\n            format!(\n                \"Could not find project at {}. \\\n                 Make sure the specified directory exists.\",\n                root.display()\n            )\n        })?;\n        ensure!(\n            root.join(\"Cargo.toml\").exists(),\n            \"No Cargo.toml found at {}. \\\n             The path must point to a Rust project directory.\",\n            root.display()\n        );\n        Ok(Self { root })\n    }\n\n    /// Runs the unit and integration tests of an application.\n    pub fn test(&self) -> Result<()> {\n        let tests = Command::new(\"cargo\")\n            .arg(\"test\")\n            .args([\"--target\", CURRENT_PLATFORM])\n            .current_dir(&self.root)\n            .spawn()?\n            .wait()?;\n        ensure!(tests.success(), \"tests failed\");\n        Ok(())","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-service/src/project.rs#L76-L112","documentation":"Project::from_existing_project treats the given path as a Rust project root and requires a Cargo.toml there. Without a manifest the path is not a Cargo project, so building the application's WASM contract and service is impossible and the call fails.","triggerScenarios":"`linera project publish <path>` (or any from_existing_project caller) where <path>/Cargo.toml does not exist: wrong directory, a typo in the path, or a non-Rust project.","commonSituations":"Running publish from the wrong cwd or pointing at the source subdir (src/) or build output instead of the crate root; the project was never scaffolded with `linera project new`.","solutions":["Pass the directory that actually contains Cargo.toml — usually your application's crate root","Verify with `ls <path>/Cargo.toml` before running the command","If the project does not exist yet, create it first with `linera project new`"],"exampleFix":"# before\n$ linera project publish ./my-dapp/src\nerror: No Cargo.toml found at my-dapp/src ...\n\n# after\n$ linera project publish ./my-dapp","handlingStrategy":"validation","validationCode":"let manifest = path.join(\"Cargo.toml\");\nif !manifest.exists() {\n    anyhow::bail!(\"not a Rust project (no Cargo.toml at {})\", path.display());\n}","typeGuard":"fn is_rust_project(path: &std::path::Path) -> bool {\n    path.join(\"Cargo.toml\").exists()\n}","tryCatchPattern":null,"preventionTips":["Always pass the crate root directory, not src/ or build output","Verify with ls <path>/Cargo.toml before publish commands"],"tags":["cli","project","cargo","manifest","validation"],"backgroundTag":"missing-cargo-manifest","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}