wasmerio/wasmer · error
Could not parse app.yaml: {err:?}
Error message
Could not parse app.yaml: {err:?} What it means
`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.
Source
Thrown at lib/cli/src/commands/app/util.rs:368
env.client()
}
pub fn get_app_config_from_dir_opt(
path: &Path,
) -> Result<Option<(AppConfigV1, std::path::PathBuf)>, anyhow::Error> {
let app_config_path = path.join(AppConfigV1::CANONICAL_FILE_NAME);
if !app_config_path.exists() || !app_config_path.is_file() {
return Ok(None);
}
// read the app.yaml
let raw_app_config = std::fs::read_to_string(&app_config_path)
.with_context(|| format!("Could not read file '{}'", app_config_path.display()))?;
// parse the app.yaml
let config = AppConfigV1::parse_yaml(&raw_app_config)
.map_err(|err| anyhow::anyhow!("Could not parse app.yaml: {err:?}"))?;
Ok(Some((config, app_config_path)))
}
pub fn get_app_config_from_current_dir_opt()
-> Result<Option<(AppConfigV1, std::path::PathBuf)>, anyhow::Error> {
let current_dir = std::env::current_dir()?;
get_app_config_from_dir_opt(¤t_dir)
}
pub fn get_app_config_from_dir(
path: &Path,
) -> Result<(AppConfigV1, std::path::PathBuf), anyhow::Error> {
get_app_config_from_dir_opt(path)?
.with_context(|| {
format!(
"Could not find app.yaml in directory: '{}'.\nPlease specify an app like 'wasmer app get <namespace>/<name>' or 'wasmer app get <name>`'",
path.display()View on GitHub (pinned to 8c4b9ee9d3)
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.
Example fix
# before (invalid: missing required field, bad indentation) app_id: my-app kind: wasmer.io/App.v0 owner: me name: extra # after app_id: my-app kind: wasmer.io/App.v0 owner: me name: my-app description: "" package: .
Defensive patterns
Strategy: validation
Validate before calling
// validate before invoking CLI commands that read app.yaml
let raw = std::fs::read_to_string("app.yaml")?;
if raw.contains('\t') {
eprintln!("app.yaml contains tabs; use spaces for indentation");
}
// optionally dry-run parse with serde_yaml + required-field checks before deploy Try / catch
match get_app_config_from_current_dir_opt() {
Ok(Some((config, path))) => config,
Ok(None) => anyhow::bail!("no app.yaml found in this directory"),
Err(e) if e.to_string().contains("Could not parse app.yaml") => {
eprintln!("fix app.yaml: {e:#}");
std::process::exit(1);
}
Err(e) => return Err(e),
} Prevention
- 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.
When it happens
Trigger: 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`.
Common situations: 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.
Related errors
- could not parse YAML for format-preserving edit: {e}
- could not parse YAML semantically: {e}
- Stack size must be 1024-bit aligned
- Headless is not a valid runtime to instantiate directly
- config from file: {e}
AI-assisted analysis of wasmerio/wasmer@8c4b9ee9d3 (2026-09-01).
Data as JSON: /api/errors/7fc06bfa86ae1bc5.
Report an issue: GitHub.