dotnet/runtime · error

Option : missing path

Error message

Option %s: missing path

What it means

Printed at src/coreclr/hosts/corerun/corerun.cpp:787 when the -c/--clr-path option is given as the last argument with no value following it. corerun increments i and finds i>=argc, so there is no path to set as the runtime location.

Solutions

  1. Provide a path immediately after -c/--clr-path.
  2. If the path comes from a variable, ensure the variable is set and non-empty before invoking corerun.
  3. Prefer setting CORE_ROOT over -c for shorter command lines.

Example fix

# before
corerun -c  MyApp.dll
# after
export CLR=/opt/dotnet/shared/Microsoft.NETCore.App/8.0.0
corerun -c "$CLR" MyApp.dll
Defensive patterns

Strategy: validation

Validate before calling

// Ensure -c/--clr-path is always followed by a non-empty path
bool clr_path_ok(int argc, char** argv) {
    for (int i=1;i<argc;i++) {
        if (!strcmp(argv[i],"-c") || !strcmp(argv[i],"--clr-path")) {
            if (i+1>=argc || argv[i+1][0]=='\0') return false;
        }
    }
    return true;
}

Prevention

When it happens

Trigger: Triggered by `corerun -c` or `corerun --clr-path` with no subsequent argument, i.e. the option is the last token on the command line.

Common situations: Shell scripts where $CLR is unset/unexpanded (e.g. `corerun -c $CLR MyApp.dll` with empty CLR), or a truncated command line copied from documentation.

Related errors


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

Appendix: 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 60108ba66e)