{"record":{"id":"7fc06bfa86ae1bc5","repo":"wasmerio/wasmer","slug":"could-not-parse-app-yaml-err","errorCode":null,"errorMessage":"Could not parse app.yaml: {err:?}","messagePattern":"Could not parse app\\.yaml: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/cli/src/commands/app/util.rs","lineNumber":368,"sourceCode":"\n    env.client()\n}\n\npub fn get_app_config_from_dir_opt(\n    path: &Path,\n) -> Result<Option<(AppConfigV1, std::path::PathBuf)>, anyhow::Error> {\n    let app_config_path = path.join(AppConfigV1::CANONICAL_FILE_NAME);\n\n    if !app_config_path.exists() || !app_config_path.is_file() {\n        return Ok(None);\n    }\n    // read the app.yaml\n    let raw_app_config = std::fs::read_to_string(&app_config_path)\n        .with_context(|| format!(\"Could not read file '{}'\", app_config_path.display()))?;\n\n    // parse the app.yaml\n    let config = AppConfigV1::parse_yaml(&raw_app_config)\n        .map_err(|err| anyhow::anyhow!(\"Could not parse app.yaml: {err:?}\"))?;\n\n    Ok(Some((config, app_config_path)))\n}\n\npub fn get_app_config_from_current_dir_opt()\n-> Result<Option<(AppConfigV1, std::path::PathBuf)>, anyhow::Error> {\n    let current_dir = std::env::current_dir()?;\n    get_app_config_from_dir_opt(&current_dir)\n}\n\npub fn get_app_config_from_dir(\n    path: &Path,\n) -> Result<(AppConfigV1, std::path::PathBuf), anyhow::Error> {\n    get_app_config_from_dir_opt(path)?\n        .with_context(|| {\n            format!(\n                \"Could not find app.yaml in directory: '{}'.\\nPlease specify an app like 'wasmer app get <namespace>/<name>' or 'wasmer app get <name>`'\",\n                path.display()","sourceCodeStart":350,"sourceCodeEnd":386,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/cli/src/commands/app/util.rs#L350-L386","documentation":"`get_app_config_from_dir_opt` reads `app.yaml` from a directory and parses it into `AppConfigV1`. If `AppConfigV1::parse_yaml` fails — malformed YAML or schema violations — the error is reformatted into this message. It indicates the app.yaml present on disk is not a valid Wasmer app config.","triggerScenarios":"Calling any command that auto-discovers app.yaml (`wasmer app deploy`, `wasmer app secrets`, etc.) from a directory whose `app.yaml` fails `AppConfigV1::parse_yaml`.","commonSituations":"Hand-edited app.yaml with wrong indentation; missing required fields like `app_id` or `kind`; using config keys from an older/newer CLI schema version; YAML tabs instead of spaces; truncated file.","solutions":["Read the inner `err:?` detail in the message and fix the offending YAML field/indentation.","Validate against the current AppConfigV1 schema — run `wasmer app create` to regenerate a known-good app.yaml and compare.","Check for tabs, missing quotes, or trailing garbage in the file with a YAML linter.","Ensure your CLI and any CI tooling agree on the config schema version."],"exampleFix":"# before (invalid: missing required field, bad indentation)\napp_id: my-app\nkind: wasmer.io/App.v0\nowner: me\n  name: extra\n# after\napp_id: my-app\nkind: wasmer.io/App.v0\nowner: me\nname: my-app\ndescription: \"\"\npackage: .","handlingStrategy":"validation","validationCode":"// validate before invoking CLI commands that read app.yaml\nlet raw = std::fs::read_to_string(\"app.yaml\")?;\nif raw.contains('\\t') {\n    eprintln!(\"app.yaml contains tabs; use spaces for indentation\");\n}\n// optionally dry-run parse with serde_yaml + required-field checks before deploy","typeGuard":null,"tryCatchPattern":"match get_app_config_from_current_dir_opt() {\n    Ok(Some((config, path))) => config,\n    Ok(None) => anyhow::bail!(\"no app.yaml found in this directory\"),\n    Err(e) if e.to_string().contains(\"Could not parse app.yaml\") => {\n        eprintln!(\"fix app.yaml: {e:#}\");\n        std::process::exit(1);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Lint app.yaml with a YAML parser in CI before deploy.","Keep app.yaml schema keys in sync with your CLI version; regenerate via `wasmer app create` when upgrading.","Never hand-edit app.yaml without re-validating; avoid tabs and unquoted special characters."],"tags":["yaml","configuration","parsing"],"backgroundTag":"config-parse-failed","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}