{"id":"350219ce68a6a3e0","repo":"rust-lang/cargo","slug":"cannot-publish-with-open-namespaces","errorCode":null,"errorMessage":"cannot publish with `open-namespaces`","messagePattern":"cannot publish with `open-namespaces`","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/workspace/parser/mod.rs","lineNumber":3016,"sourceCode":"\n/// Prepares the manifest for publishing.\n// - Path and git components of dependency specifications are removed.\n// - License path is updated to point within the package.\nfn prepare_toml_for_publish(\n    me: &manifest::TomlManifest,\n    ws: &Workspace<'_>,\n    package_root: &Path,\n    packaged_files: Option<&[PathBuf]>,\n) -> CargoResult<manifest::TomlManifest> {\n    let gctx = ws.gctx();\n\n    if me\n        .cargo_features\n        .iter()\n        .flat_map(|f| f.iter())\n        .any(|f| f == \"open-namespaces\")\n    {\n        anyhow::bail!(\"cannot publish with `open-namespaces`\")\n    }\n\n    let mut package = me.package().unwrap().clone();\n    package.workspace = None;\n    // Validates if build script file is included in package. If not, warn and ignore.\n    if let Some(custom_build_scripts) = package.normalized_build().expect(\"previously normalized\") {\n        let mut included_scripts = Vec::new();\n        for script in custom_build_scripts {\n            let path = Path::new(script).to_path_buf();\n            let included = packaged_files.map(|i| i.contains(&path)).unwrap_or(true);\n            if included {\n                let path = path\n                    .into_os_string()\n                    .into_string()\n                    .map_err(|_err| anyhow::format_err!(\"non-UTF8 `package.build`\"))?;\n                let path = normalize_path_string_sep(path);\n                included_scripts.push(path);\n            } else {","sourceCodeStart":2998,"sourceCodeEnd":3034,"githubUrl":"https://github.com/rust-lang/cargo/blob/0e07a155371a6ce88ae53a2c00df940280c09a67/src/workspace/parser/mod.rs#L2998-L3034","documentation":"Error \"cannot publish with `open-namespaces`\" thrown in rust-lang/cargo.","triggerScenarios":"Thrown at src/workspace/parser/mod.rs:3016 when the library encounters an invalid state.","commonSituations":"Occurs when `cargo publish` is run on a package whose manifest enables the unstable `open-namespaces` feature. Avoid enabling `open-namespaces` for packages intended to be published, or remove the feature before publishing.","solutions":["Remove `open-namespaces` from the manifest before publishing; it is only supported on nightly for local development.","If you need namespace features, build with `-Zopen-namespaces` locally but publish without the flag."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"0e07a155371a6ce88ae53a2c00df940280c09a67","analyzedAt":"2026-08-06T01:46:58.334Z","schemaVersion":2}