dotnet/runtime · warning

Option %s: missing path

Error message

Option %s: missing path

What it means

Printed by parse_args() when -c / --clr-path is the LAST token on the command line (i becomes >= argc after i++). The option expects a following path argument but none exists. Parsing breaks and returns false -> EXIT_FAILURE.

Source

Thrown at src/coreclr/hosts/corerun/corerun.cpp:787

            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);
                break;
            }
        }
        else if (pal::strcmp(option, W("p")) == 0 || (pal::strcmp(option, W("property")) == 0))
        {
            i++;
            if (i >= argc)
            {
                pal::fprintf(stderr, W("Option %s: missing property\n"), arg);
                break;
            }

            string_t prop = argv[i];
            size_t delim_maybe = prop.find(W('='));
            if (delim_maybe == string_t::npos)
            {
                pal::fprintf(stderr, W("Option %s: '%s' missing property value\n"), arg, prop.c_str());
                break;

View on GitHub (pinned to 290d5ab72c)

Solutions

  1. Supply the path immediately after --clr-path: 'corerun -c /path/to/coreclr App.dll'.
  2. Or set CORE_ROOT env var instead and drop the -c option.
  3. Double-check shell quoting didn't consume the path token.

Example fix

# before
corerun --clr-path
# after
corerun --clr-path /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.x App.dll
Defensive patterns

Strategy: validation

Validate before calling

# ensure --clr-path/-c is never the trailing token
if [ "${@: -1}" = "-c" ] || [ "${@: -1}" = "--clr-path" ]; then
  echo '--clr-path requires a following path'; exit 2
fi

Prevention

When it happens

Trigger: User runs: 'corerun --clr-path' (no path after), or 'corerun App.dll -c' where -c is the trailing token after the assembly — though note the assembly is consumed first so -c after the assembly is treated as an arg. The actual trigger is -c/--clr-path as the final token before the assembly slot.

Common situations: Forgotten path argument; quoting mistake that swallowed the path; trailing option at end of line.

Related errors


AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06). Data as JSON: /api/errors/7ae76a8a52032ca3. Report an issue: GitHub.