dotnet/runtime · warning
Option %s: missing .env file path
Error message
Option %s: missing .env file path
What it means
Printed by parse_args() when -e / --env is the LAST token (i >= argc after i++). The option expects a path to a .env file whose variables corerun will load_into_current_process(). None follows. Parsing breaks and returns false.
Source
Thrown at src/coreclr/hosts/corerun/corerun.cpp:843
{
break;
}
}
else if (pal::strcmp(option, W("d")) == 0 || (pal::strcmp(option, W("debug")) == 0))
{
config.wait_to_debug = true;
}
else if (pal::strcmp(option, W("st")) == 0)
{
config.self_test = true;
return true;
}
else if (pal::strcmp(option, W("e")) == 0 || (pal::strcmp(option, W("env")) == 0))
{
i++;
if (i >= argc)
{
pal::fprintf(stderr, W("Option %s: missing .env file path\n"), arg);
break;
}
std::ifstream dotenvFile{ pal::convert_to_utf8(argv[i]) };
config.dotenv_configuration = dotenv{ pal::string_t{ argv[i] }, dotenvFile};
}
else if ((pal::strcmp(option, W("?")) == 0 || (pal::strcmp(option, W("h")) == 0 || (pal::strcmp(option, W("help")) == 0))))
{
display_usage();
break;
}
else
{
pal::fprintf(stderr, W("Unknown option %s\n"), arg);
break;
}
}
View on GitHub (pinned to 290d5ab72c)
Solutions
- Supply the .env file path: 'corerun -e ./.env App.dll'.
- Ensure the file is readable; it is opened with std::ifstream in UTF-8.
- Drop -e and export the variables directly in the shell if simpler.
Example fix
# before corerun -e App.dll # after corerun -e ./config/.env App.dll
Defensive patterns
Strategy: validation
Validate before calling
# ensure -e/--env is never the trailing token
if [ "${@: -1}" = "-e" ] || [ "${@: -1}" = "--env" ]; then
echo '-e requires a following .env file path'; exit 2
fi Prevention
- Always follow -e with a readable .env file path.
- Prefer exporting variables in the shell if you only need a couple.
- Confirm the file is UTF-8 (opened with std::ifstream).
When it happens
Trigger: User runs 'corerun -e' with no path after. The dotenv file is later loaded via config.dotenv_configuration.load_into_current_process() inside run().
Common situations: Forgotten .env path; trailing -e; meant to use shell 'source .env' instead.
Related errors
- Option %s: invalid form
- Option %s: missing path
- Option %s: missing property
- Option %s: '%s' missing property value
- Option %s: missing shared library path
AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06).
Data as JSON: /api/errors/f75f6269c6a6e4f0.
Report an issue: GitHub.