dotnet/runtime · warning
Option %s: invalid form
Error message
Option %s: invalid form
What it means
Printed by parse_args() when an argv token starts with an option delimiter (is_cli_option true) but has length 1 — i.e. the token is exactly '-' (or '/' on Windows). Such a token has no option name and is rejected as invalid form. Parsing then breaks out of the loop and returns false, causing EXIT_FAILURE in MAIN.
Source
Thrown at src/coreclr/hosts/corerun/corerun.cpp:769
i++; // Move to next argument.
config.entry_assembly_argc = argc - i;
config.entry_assembly_argv = (const char_t**)::malloc(config.entry_assembly_argc * sizeof(const char_t*));
assert(config.entry_assembly_argv != nullptr);
for (int c = 0; c < config.entry_assembly_argc; ++c)
{
config.entry_assembly_argv[c] = pal::strdup(argv[i + c]);
}
// Successfully parsed arguments.
return true;
}
const char_t* arg = argv[i];
size_t arg_len = pal::strlen(arg);
if (arg_len == 1)
{
pal::fprintf(stderr, W("Option %s: invalid form\n"), arg);
break; // Invalid option
}
const char_t* option = arg + 1;
if (option[0] == W('-')) // Handle double '--'
option++;
// Path to core_root
if (pal::strcmp(option, W("c")) == 0 || (pal::strcmp(option, W("clr-path")) == 0))
{
i++;
if (i < argc)
{
config.clr_path = argv[i];
}
else
{
pal::fprintf(stderr, W("Option %s: missing path\n"), arg);View on GitHub (pinned to 290d5ab72c)
Solutions
- Remove the lone '-' or replace it with the intended option (e.g. -d / --debug).
- Run 'corerun --help' (or -h / -?) to see the valid options.
- Validate the command line in your build script with a check that no token is a single '-'.
Example fix
# before corerun - App.dll # after corerun -d App.dll
Defensive patterns
Strategy: validation
Validate before calling
# reject a lone '-' / '/' before launching corerun
for a in "$@"; do
if [ "$a" = "-" ] || [ "$a" = "/" ]; then
echo "invalid lone option token: $a"; exit 2
fi
done Prevention
- Double-check options that begin with '-' actually have a name after the dash.
- Run 'corerun --help' when in doubt.
- In scripts, fail fast on a single-dash token.
When it happens
Trigger: User runs: corerun - App.dll (a bare '-' as first token), or 'corerun App.dll -' where the lone '-' is hit before the assembly token... but actually the assembly is taken as soon as a non-option token appears, so the trigger is specifically a leading lone '-' / '/' before the assembly.
Common situations: Typos like 'corerun -' meaning to type '-d'; copy-paste of an empty option; shell quoting that collapsed an option to a single dash; using '/' alone on Windows.
Related errors
- Option %s: missing path
- Option %s: missing property
- Option %s: '%s' missing property value
- Option %s: missing shared library path
- Option %s: missing .env file path
AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06).
Data as JSON: /api/errors/78d02a04c1d83ec9.
Report an issue: GitHub.