{"record":{"id":"78d02a04c1d83ec9","repo":"dotnet/runtime","slug":"option-s-invalid-form","errorCode":null,"errorMessage":"Option %s: invalid form\n","messagePattern":"Option (.+?): invalid form\n","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/coreclr/hosts/corerun/corerun.cpp","lineNumber":769,"sourceCode":"            i++; // Move to next argument.\n\n            config.entry_assembly_argc = argc - i;\n            config.entry_assembly_argv = (const char_t**)::malloc(config.entry_assembly_argc * sizeof(const char_t*));\n            assert(config.entry_assembly_argv != nullptr);\n            for (int c = 0; c < config.entry_assembly_argc; ++c)\n            {\n                config.entry_assembly_argv[c] = pal::strdup(argv[i + c]);\n            }\n\n            // Successfully parsed arguments.\n            return true;\n        }\n\n        const char_t* arg = argv[i];\n        size_t arg_len = pal::strlen(arg);\n        if (arg_len == 1)\n        {\n            pal::fprintf(stderr, W(\"Option %s: invalid form\\n\"), arg);\n            break; // Invalid option\n        }\n\n        const char_t* option = arg + 1;\n        if (option[0] == W('-')) // Handle double '--'\n            option++;\n\n        // Path to core_root\n        if (pal::strcmp(option, W(\"c\")) == 0 || (pal::strcmp(option, W(\"clr-path\")) == 0))\n        {\n            i++;\n            if (i < argc)\n            {\n                config.clr_path = argv[i];\n            }\n            else\n            {\n                pal::fprintf(stderr, W(\"Option %s: missing path\\n\"), arg);","sourceCodeStart":751,"sourceCodeEnd":787,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/coreclr/hosts/corerun/corerun.cpp#L751-L787","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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 '-'."],"exampleFix":"# before\ncorerun - App.dll\n# after\ncorerun -d App.dll","handlingStrategy":"validation","validationCode":"# reject a lone '-' / '/' before launching corerun\nfor a in \"$@\"; do\n  if [ \"$a\" = \"-\" ] || [ \"$a\" = \"/\" ]; then\n    echo \"invalid lone option token: $a\"; exit 2\n  fi\ndone","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["coreclr","corerun","cli","argument-parsing","usage"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}