{"record":{"id":"9ea83ddfe9b0e0a4","repo":"symfony/process","slug":"command-line-is-missing-a-value-for-parameter-s","errorCode":null,"errorMessage":"Command line is missing a value for parameter \"%s\": ","messagePattern":"Command line is missing a value for parameter \"(.+?)\": ","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"Process.php","lineNumber":1703,"sourceCode":"        if (str_contains($argument, \"\\0\")) {\n            $argument = str_replace(\"\\0\", '?', $argument);\n        }\n        if (!preg_match('/[()%!^\"<>&|\\s[\\]=;*?\\'$]/', $argument)) {\n            return $argument;\n        }\n        $argument = preg_replace('/(\\\\\\\\+)$/', '$1$1', $argument);\n\n        return '\"'.str_replace(['\"', '^', '%', '!', \"\\n\"], ['\"\"', '\"^^\"', '\"^%\"', '\"^!\"', '!LF!'], $argument).'\"';\n    }\n\n    /**\n     * @param EnvArray $env\n     */\n    private function replacePlaceholders(string $commandline, array $env): string\n    {\n        return preg_replace_callback('/\"\\$\\{:([_a-zA-Z]++[_a-zA-Z0-9]*+)\\}\"/', function ($matches) use ($commandline, $env) {\n            if (!isset($env[$matches[1]]) || false === $env[$matches[1]]) {\n                throw new InvalidArgumentException(\\sprintf('Command line is missing a value for parameter \"%s\": ', $matches[1]).$commandline);\n            }\n\n            return $this->escapeArgument($env[$matches[1]]);\n        }, $commandline);\n    }\n\n    /**\n     * @return EnvArray\n     */\n    private function getDefaultEnv(): array\n    {\n        $env = getenv();\n        $env = ('\\\\' === \\DIRECTORY_SEPARATOR ? array_intersect_ukey($env, $_SERVER, 'strcasecmp') : array_intersect_key($env, $_SERVER)) ?: $env;\n        $env = $_ENV + ('\\\\' === \\DIRECTORY_SEPARATOR ? array_diff_ukey($env, $_ENV, 'strcasecmp') : $env);\n\n        if (\\in_array(\\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {\n            return $env;\n        }","sourceCodeStart":1685,"sourceCodeEnd":1721,"githubUrl":"https://github.com/symfony/process/blob/99b85026db14a68f02c6f3eeb01a1170ca25c491/Process.php#L1685-L1721","documentation":"Process supports escaped env placeholders like \"${:VAR}\" in the command line. replacePlaceholders() substitutes them at start(); if the referenced env variable is unset or false, an InvalidArgumentException naming the parameter and full command line is thrown.","triggerScenarios":"Starting a process whose command contains \"${:MY_VAR}\" while MY_VAR is absent (or explicitly false) in the env array passed to start()/Process.","commonSituations":"Missing env vars in CI/local environments, typo between the placeholder name and env key, env var explicitly set to false which the guard treats as missing.","solutions":["Ensure the env variable is set and not false before start(): $env['MY_VAR'] ?? throw or default","Fix the placeholder name to match an existing env key","Use getenv()/$_ENV checks or provide a default in the env array passed to start()"],"exampleFix":"// before\n$process->start(['FOO' => null]); // command contains \"${:FOO}\"\n// after\n$process->start(['FOO' => 'bar']); // or remove \"${:FOO}\" from the command","handlingStrategy":"validation","validationCode":"foreach ($placeholders as $name) {\n    if (!isset($env[$name]) || $env[$name] === false) {\n        throw new InvalidArgumentException(\"Missing env for placeholder {$name}\");\n    }\n}\n$process->start($env);","typeGuard":null,"tryCatchPattern":"try { $process->start($env); } catch (InvalidArgumentException $e) { /* report missing env var from message */ }","preventionTips":["Validate all \"${:VAR}\" placeholders against the env array before start()","Remember false-valued env vars count as missing","Keep placeholder names and env keys defined in one shared constant list"],"tags":["php","process","env","placeholder"],"backgroundTag":"missing-env-var","analyzedSha":"99b85026db14a68f02c6f3eeb01a1170ca25c491","analyzedAt":"2026-09-14T11:23:33.683Z","contentChangedAt":"2026-09-14T11:23:33.683Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}