{"record":{"id":"cac6f72278e01ae1","repo":"flarum/framework","slug":"this-value-is-required","errorCode":null,"errorMessage":"This value is required","messagePattern":"This value is required","errorType":"validation","errorClass":"ValidationFailed","httpStatus":null,"severity":"warning","filePath":"framework/core/src/Install/Console/UserDataProvider.php","lineNumber":141,"sourceCode":"    private function getSettings(): array\n    {\n        $title = $this->ask('Forum title:');\n\n        return [\n            'forum_title' => $title,\n            'mail_from' => $this->baseUrl->toEmail('noreply'),\n            'welcome_title' => 'Welcome to '.$title,\n        ];\n    }\n\n    private function ask(string $question, ?string $default = null, bool $required = false): mixed\n    {\n        $question = new Question(\"<question>$question</question> \", $default);\n\n        if ($required) {\n            $question->setValidator(function ($value) {\n                if (empty($value)) {\n                    throw new ValidationFailed('This value is required');\n                }\n\n                return $value;\n            });\n        }\n\n        return $this->questionHelper->ask($this->input, $this->output, $question);\n    }\n\n    private function secret(string $question): mixed\n    {\n        $question = new Question(\"<question>$question</question> \");\n\n        $question->setHidden(true)->setHiddenFallback(true);\n\n        return $this->questionHelper->ask($this->input, $this->output, $question);\n    }\n","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/flarum/framework/blob/4b939f685389bfe8a380e9e28ddf305a1c66950c/framework/core/src/Install/Console/UserDataProvider.php#L123-L159","documentation":"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.","triggerScenarios":"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.","commonSituations":"Automated installs piping an incomplete answers stream into the interactive installer; users assuming defaults exist for required fields.","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"],"exampleFix":"// non-interactive run missing a value\n// before\nphp flarum install < answers.txt  # missing baseUrl line\n// after\necho \"https://forum.example.com\\n...\" | php flarum install  # include every required answer","handlingStrategy":"try-catch","validationCode":"if (trim((string) $value) === '') {\n    throw new ValidationFailed('This value is required');\n}","typeGuard":null,"tryCatchPattern":"$question->setValidator(function ($value) {\n    if (empty($value)) { throw new ValidationFailed('This value is required'); }\n    return $value;\n});\ntry {\n    $answer = $helper->ask($input, $output, $question);\n} catch (ValidationFailed $e) { /* helper re-prompts automatically */ }","preventionTips":["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"],"tags":["cli","validation","installation","interactive-prompt"],"backgroundTag":"missing-required-argument","analyzedSha":"4b939f685389bfe8a380e9e28ddf305a1c66950c","analyzedAt":"2026-09-15T18:09:20.879Z","contentChangedAt":"2026-09-15T18:09:20.879Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}