Skip to content

🐛 Fix empty error message for missing required fields - #3

Merged
cowboyd merged 1 commit into
mainfrom
bugfix
Mar 1, 2026
Merged

cowboyd merged 1 commit into
mainfrom
bugfix

Conversation

@cowboyd

@cowboyd cowboyd commented Mar 1, 2026

Copy link
Copy Markdown
Collaborator

Motivation

When a required field has no input sources (no CLI args, env vars, or defaults), the error message is empty. For example, running staticalize with no arguments shows blank lines where the validation errors should be:

site: 
base: 

`staticalize --help` for available options

Approach

The ValidationError was constructed with an empty sources array because the "none" source (representing the undefined fallback) was only pushed into sources on the success path. Moved sources.push(source) to happen unconditionally so validation issues are always included in the error message. Added a minimal regression test.

When a required field had no sources at all (no CLI args, env vars, or
defaults), the "none" source was not added to the sources array before
constructing the ValidationError, resulting in an empty error message.
@cowboyd
cowboyd merged commit f90e149 into main Mar 1, 2026
1 of 2 checks passed
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