{"id":"a57572a1b715dcfc","repo":"rust-lang/cargo","slug":"manifest-key-name-does-not-appear-to-exist","errorCode":null,"errorMessage":"{manifest_key_name} `{}` does not appear to exist{}.\n                Please update the {manifest_key_name} setting in the manifest at `{}`.","messagePattern":"(.+?) `(.+?)` does not appear to exist(.+?)\\.\n                Please update the (.+?) setting in the manifest at `(.+?)`\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/ops/cargo_package/mod.rs","lineNumber":621,"sourceCode":"                &pkg,\n                &license_path,\n                \"license-file\",\n                &mut invalid_manifest_field,\n            );\n        }\n    }\n    if let Some(readme) = &pkg.manifest().metadata().readme {\n        let readme_path = Path::new(readme);\n        let abs_file_path = paths::normalize_path(&pkg.root().join(readme_path));\n        if abs_file_path.is_file() {\n            check_for_file_and_add(\"readme\", readme_path, abs_file_path, pkg, &mut result, ws)?;\n        } else {\n            error_on_nonexistent_file(&pkg, &readme_path, \"readme\", &mut invalid_manifest_field);\n        }\n    }\n\n    if !invalid_manifest_field.is_empty() {\n        return Err(anyhow::anyhow!(invalid_manifest_field.join(\"\\n\")));\n    }\n\n    for t in pkg\n        .manifest()\n        .targets()\n        .iter()\n        .filter(|t| t.is_custom_build())\n    {\n        if let Some(custom_build_path) = t.src_path().path() {\n            let abs_custom_build_path = paths::normalize_path(&pkg.root().join(custom_build_path));\n            if !abs_custom_build_path.is_file() || !abs_custom_build_path.starts_with(pkg.root()) {\n                error_custom_build_file_not_in_package(pkg, &abs_custom_build_path, t)?;\n            }\n        }\n    }\n\n    result.sort_unstable_by(|a, b| a.rel_path.cmp(&b.rel_path));\n","sourceCodeStart":603,"sourceCodeEnd":639,"githubUrl":"https://github.com/rust-lang/cargo/blob/0e07a155371a6ce88ae53a2c00df940280c09a67/src/ops/cargo_package/mod.rs#L603-L639","documentation":"During packaging, Cargo validates manifest path fields (`license-file` and `readme`) by joining them to the package root and checking is_file(). If the referenced file is missing, error_on_nonexistent_file pushes a message (naming the manifest key, the path, and the manifest location) into invalid_manifest_field; once all checks finish, if that buffer is non-empty it is thrown as a single aggregated anyhow error at cargo_package/mod.rs:621.","triggerScenarios":"`cargo package` with `license-file = \"LICENSE\"` when no LICENSE file exists, or `readme = \"README.md\"` after the README was deleted/renamed. Also fires if the path is relative but resolves outside the package.","commonSituations":"Deleted the README but left `readme = ` in Cargo.toml; renamed LICENSE-MIT to LICENSE without updating the manifest; path typos; CI packaging a sparse checkout that omitted the license/readme; relative paths that escape the package root.","solutions":["Create or restore the referenced file (e.g. `touch README.md` or restore LICENSE)","Update Cargo.toml so `license-file`/`readme` points to the correct existing path","Remove the field from Cargo.toml entirely if the file is not needed","Ensure the path is relative to the package root and the file is committed (not gitignored)"],"exampleFix":"# before\n# Cargo.toml: readme = \"README.md\"  (file missing)\ncargo package   # -> error\n# after (option A): create the file\necho '# mycrate' > README.md\n# after (option B): fix the path\n# readme = \"docs/README.md\"\n# after (option C): drop the field\n# (remove the readme = line)","handlingStrategy":"validation","validationCode":"use std::path::{Path, PathBuf};\nfn validate_manifest_paths(root: &Path, fields: &[(&str, &str)]) -> Result<(), String> {\n    for (key, val) in fields {\n        let abs = root.join(val);\n        if !abs.is_file() {\n            return Err(format!(\"{key} `{val}` does not exist at {}\", abs.display()));\n        }\n    }\n    Ok(())\n}\n\nvalidate_manifest_paths(root, &[(\"readme\", readme), (\"license-file\", license)])?;","typeGuard":"import { existsSync } from 'fs';\nimport { join } from 'path';\nfunction manifestPathsExist(root: string, fields: Record<string,string>): boolean {\n  return Object.entries(fields).every(([_, rel]) => existsSync(join(root, rel)));\n}","tryCatchPattern":null,"preventionTips":["Run `cargo package --list` to surface missing readme/license-file before publishing","Add a CI step that asserts Cargo.toml path fields resolve to real files","When renaming/deleting README/LICENSE, update Cargo.toml in the same commit"],"tags":["cargo-package","manifest","readme","license-file","validation"],"analyzedSha":"0e07a155371a6ce88ae53a2c00df940280c09a67","analyzedAt":"2026-08-06T01:46:58.334Z","schemaVersion":2}