flarum/framework · warning · ValidationFailed
This value is required
Error message
This value is required
What it means
In the console installer's UserDataProvider, the ask() helper attaches a validator to required Symfony Question prompts. If the user submits an empty value (just pressing Enter) for a required question, ValidationFailed('This value is required') is thrown and the question is re-asked by the Symfony Console helper loop.
Solutions
- Supply a value when the prompt appears (blank input is not accepted for required fields)
- Provide all required values in the piped/stdin answer list for automation
- Make the question optional by passing a $default and required=false where a sensible default exists
Example fix
// non-interactive run missing a value // before php flarum install < answers.txt # missing baseUrl line // after echo "https://forum.example.com\n..." | php flarum install # include every required answer
Defensive patterns
Strategy: try-catch
Validate before calling
if (trim((string) $value) === '') {
throw new ValidationFailed('This value is required');
} Try / catch
$question->setValidator(function ($value) {
if (empty($value)) { throw new ValidationFailed('This value is required'); }
return $value;
});
try {
$answer = $helper->ask($input, $output, $question);
} catch (ValidationFailed $e) { /* helper re-prompts automatically */ } Prevention
- Provide every required answer when piping stdin for automated installs
- Set sensible $default values so pressing Enter is valid where possible
- Test headless install flows against the full interactive prompt sequence
When it happens
Trigger: Pressing Enter without typing anything at a required prompt during getDatabaseConfiguration, getBaseUrl, getAdminUser, or getSettings; input piped from a file/stdin that ends before the required answer is supplied.
Common situations: Automated installs piping an incomplete answers stream into the interactive installer; users assuming defaults exist for required fields.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- You must enter a valid email.
- Username can only contain letters, numbers, underscores…
- The admin password did not match its confirmation.
- Please specify a database driver.
- flarum-akismet.admin.akismet_settings.invalid_api_key_messag…
AI-assisted analysis of flarum/framework@4b939f6853 (2026-09-15).
Data as JSON: /api/errors/cac6f72278e01ae1.
Report an issue: GitHub.
Appendix: source
Thrown at framework/core/src/Install/Console/UserDataProvider.php:141
private function getSettings(): array
{
$title = $this->ask('Forum title:');
return [
'forum_title' => $title,
'mail_from' => $this->baseUrl->toEmail('noreply'),
'welcome_title' => 'Welcome to '.$title,
];
}
private function ask(string $question, ?string $default = null, bool $required = false): mixed
{
$question = new Question("<question>$question</question> ", $default);
if ($required) {
$question->setValidator(function ($value) {
if (empty($value)) {
throw new ValidationFailed('This value is required');
}
return $value;
});
}
return $this->questionHelper->ask($this->input, $this->output, $question);
}
private function secret(string $question): mixed
{
$question = new Question("<question>$question</question> ");
$question->setHidden(true)->setHiddenFallback(true);
return $this->questionHelper->ask($this->input, $this->output, $question);
}
View on GitHub (pinned to 4b939f6853)