{"record":{"id":"7ae76a8a52032ca3","repo":"dotnet/runtime","slug":"option-s-missing-path","errorCode":null,"errorMessage":"Option %s: missing path\n","messagePattern":"Option (.+?): missing path\n","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/coreclr/hosts/corerun/corerun.cpp","lineNumber":787,"sourceCode":"            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);\n                break;\n            }\n        }\n        else if (pal::strcmp(option, W(\"p\")) == 0 || (pal::strcmp(option, W(\"property\")) == 0))\n        {\n            i++;\n            if (i >= argc)\n            {\n                pal::fprintf(stderr, W(\"Option %s: missing property\\n\"), arg);\n                break;\n            }\n\n            string_t prop = argv[i];\n            size_t delim_maybe = prop.find(W('='));\n            if (delim_maybe == string_t::npos)\n            {\n                pal::fprintf(stderr, W(\"Option %s: '%s' missing property value\\n\"), arg, prop.c_str());\n                break;","sourceCodeStart":769,"sourceCodeEnd":805,"githubUrl":"https://github.com/dotnet/runtime/blob/60108ba66eb7d1d12f595480091b4ad80a24b172/src/coreclr/hosts/corerun/corerun.cpp#L769-L805","documentation":"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.","triggerScenarios":"Triggered by `corerun -c` or `corerun --clr-path` with no subsequent argument, i.e. the option is the last token on the command line.","commonSituations":"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.","solutions":["Provide a path immediately after -c/--clr-path.","If the path comes from a variable, ensure the variable is set and non-empty before invoking corerun.","Prefer setting CORE_ROOT over -c for shorter command lines."],"exampleFix":"# before\ncorerun -c  MyApp.dll\n# after\nexport CLR=/opt/dotnet/shared/Microsoft.NETCore.App/8.0.0\ncorerun -c \"$CLR\" MyApp.dll","handlingStrategy":"validation","validationCode":"// Ensure -c/--clr-path is always followed by a non-empty path\nbool clr_path_ok(int argc, char** argv) {\n    for (int i=1;i<argc;i++) {\n        if (!strcmp(argv[i],\"-c\") || !strcmp(argv[i],\"--clr-path\")) {\n            if (i+1>=argc || argv[i+1][0]=='\\0') return false;\n        }\n    }\n    return true;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass an absolute runtime path after -c.","Check env vars like $CLR are non-empty before expanding.","Prefer CORE_ROOT over -c to shorten command lines."],"tags":["coreclr","corerun","cli","argument-parsing"],"backgroundTag":null,"analyzedSha":"60108ba66eb7d1d12f595480091b4ad80a24b172","analyzedAt":"2026-08-10T18:54:11.478Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}