dotnet/runtime · warning

Unknown option %s

Error message

Unknown option %s

What it means

Printed by parse_args() in the final else branch when an option token does not match any known option (c/clr-path, p/property, l/preload, d/debug, st, e/env, ?/h/help). Parsing breaks and returns false -> EXIT_FAILURE.

Source

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

        {
            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;
        }
    }

    return false;
}

// Forward declaration for self testing method.
static int self_test();

//
// Entry points
//

int MAIN(const int argc, const char_t* argv[])
{
    configuration config{};
    if (!parse_args(argc, argv, config))

View on GitHub (pinned to 290d5ab72c)

Solutions

  1. Run 'corerun --help' to see the supported options.
  2. Fix the typo (e.g. -clr -> -c or --clr-path).
  3. Remember corerun supports only -c/--clr-path, -p/--property, -l/--preload, -d/--debug, -e/--env, -st, -?/-h/--help.

Example fix

# before
corerun --runtime-path /x App.dll
# after
corerun --clr-path /x App.dll
Defensive patterns

Strategy: validation

Validate before calling

# whitelist the only options corerun supports
allowed='^(\-c|\-\-clr-path|\-p|\-\-property|\-l|\-\-preload|\-d|\-\-debug|\-st|\-e|\-\-env|\-\?|\-h|\-\-help)$'
for a in "$@"; do
  case "$a" in -*) echo "$a" | grep -Eq "$allowed" || echo "unknown option: $a" ;; esac
done

Prevention

When it happens

Trigger: User runs e.g. 'corerun --foo bar App.dll' or 'corerun -x App.dll' or 'corerun -clr App.dll' (typo of clr-path). Any unrecognized -X / --xxx falls here.

Common situations: Typo in an option name; using options from a different host (dotnet run args) that corerun doesn't support; stale docs.

Related errors


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