Skip to content

fix: handle empty YAML config files gracefully#132

Open
AaronFeledy wants to merge 1 commit intomainfrom
fix/empty-config-crash
Open

fix: handle empty YAML config files gracefully#132
AaronFeledy wants to merge 1 commit intomainfrom
fix/empty-config-crash

Conversation

@AaronFeledy
Copy link
Member

@AaronFeledy AaronFeledy commented Feb 25, 2026

Summary

Backport of lando/core#440.

When ~/.lando/config.yml is completely empty (no {}), yaml.load() returns undefined instead of an object. This causes a TypeError: Cannot read properties of undefined (reading 'pluginDirs') crash.

Fix

Add || {} fallback after every yaml.load() call that reads config files:

  • utils/load-config-files.js — main config source loading
  • lib/cli.js — CLI config reading
  • lib/lando.js — landofile loading

Note

Low Risk
Small, localized defensive change that only affects how empty YAML files are interpreted; low chance of behavior change beyond avoiding a crash.

Overview
Prevents a crash when a config YAML file exists but is empty (so yaml.load() returns undefined) by defaulting all relevant loads to {}.

This updates config reading/merging in utils/load-config-files.js, Cli.updateUserConfig() (~/.lando/config.yml), and Lando.getApp() landofile loading to tolerate empty files, and records the fix in CHANGELOG.md (lando/core#439).

Written by Cursor Bugbot for commit 579bb5f. This will update automatically on new commits. Configure here.

When a YAML file (e.g. ~/.lando/config.yml) is completely empty,
yaml.load() returns undefined instead of an object. This causes a
TypeError when accessing properties like pluginDirs.

Default to an empty object when yaml.load() returns a falsy value
across all config loading paths.

Backport of lando/core#440
Fixes lando/core#439
@netlify
Copy link

netlify bot commented Feb 25, 2026

Deploy Preview for lando-core-next failed. Why did it fail? →

Name Link
🔨 Latest commit 579bb5f
🔍 Latest deploy log https://app.netlify.com/projects/lando-core-next/deploys/699e8113c751bf0008ea76ae

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant