{"record":{"id":"303ff130efa9326d","repo":"dotnet/runtime","slug":"option-s-missing-shared-library-path","errorCode":null,"errorMessage":"Option %s: missing shared library path\n","messagePattern":"Option (.+?): missing shared library path\n","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/coreclr/hosts/corerun/corerun.cpp","lineNumber":818,"sourceCode":"            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;\n            }\n\n            string_t key = prop.substr(0, delim_maybe);\n            string_t value = prop.substr(delim_maybe + 1);\n            config.user_defined_keys.push_back(std::move(key));\n            config.user_defined_values.push_back(std::move(value));\n        }\n        else if (pal::strcmp(option, W(\"l\")) == 0 || (pal::strcmp(option, W(\"preload\")) == 0))\n        {\n            i++;\n            if (i >= argc)\n            {\n                pal::fprintf(stderr, W(\"Option %s: missing shared library path\\n\"), arg);\n                break;\n            }\n\n            string_t library = argv[i];\n            pal::mod_t hMod;\n            if (!pal::try_load_library(library, hMod))\n            {\n                break;\n            }\n        }\n        else if (pal::strcmp(option, W(\"d\")) == 0 || (pal::strcmp(option, W(\"debug\")) == 0))\n        {\n            config.wait_to_debug = true;\n        }\n        else if (pal::strcmp(option, W(\"st\")) == 0)\n        {\n            config.self_test = true;\n            return true;","sourceCodeStart":800,"sourceCodeEnd":836,"githubUrl":"https://github.com/dotnet/runtime/blob/60108ba66eb7d1d12f595480091b4ad80a24b172/src/coreclr/hosts/corerun/corerun.cpp#L800-L836","documentation":"Printed at src/coreclr/hosts/corerun/corerun.cpp:818 when -l/--preload is given but no shared library path follows (i>=argc). The preload option needs a library file to dlopen before initializing the CLR.","triggerScenarios":"Triggered when `corerun -l` / `corerun --preload` is the final argument with no library path after it.","commonSituations":"A script passes an empty $LIB variable, or the user forgets the path while trying to set up a profiling/debugging hook library.","solutions":["Provide the full path to the shared library after -l.","Verify the variable holding the library path is set and the file exists.","Ensure the library matches the corerun architecture (64-bit library for 64-bit host)."],"exampleFix":"# before\ncorerun -l MyApp.dll\n# after\ncorerun -l /usr/lib/libmyhook.so MyApp.dll","handlingStrategy":"validation","validationCode":"// Ensure -l/--preload is followed by an existing library path\n#include <filesystem>\nbool preload_ok(int argc, char** argv) {\n    for (int i=1;i<argc;i++) {\n        if (!strcmp(argv[i],\"-l\") || !strcmp(argv[i],\"--preload\")) {\n            if (i+1>=argc) return false;\n            if (!std::filesystem::exists(argv[i+1])) return false;\n        }\n    }\n    return true;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always supply an absolute path to the preload library.","Match library architecture to the host.","Check that the variable holding the path is non-empty."],"tags":["coreclr","corerun","cli","argument-parsing","preload"],"backgroundTag":null,"analyzedSha":"60108ba66eb7d1d12f595480091b4ad80a24b172","analyzedAt":"2026-08-10T18:54:11.478Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}