{"record":{"id":"559dab961708e72d","repo":"dotnet/runtime","slug":"begin-coreclr-initialize-failed-error-0x-08x","errorCode":null,"errorMessage":"BEGIN: coreclr_initialize failed - Error: 0x%08x\n","messagePattern":"BEGIN: coreclr_initialize failed - Error: 0x%08x\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/coreclr/hosts/corerun/corerun.cpp","lineNumber":615,"sourceCode":"    }\n\n#ifdef TARGET_WASM\n    // install the pinvoke override callback to resolve p/invokes to statically linked libraries\n    add_pinvoke_override();\n#endif // TARGET_WASM\n\n    int result;\n    result = coreclr_init_func(\n        exe_path_utf8.c_str(),\n        \"corerun\",\n        propertyCount,\n        propertyKeys.data(),\n        propertyValues.data(),\n        &CurrentClrInstance,\n        &CurrentAppDomainId);\n    if (FAILED(result))\n    {\n        pal::fprintf(stderr, W(\"BEGIN: coreclr_initialize failed - Error: 0x%08x\\n\"), result);\n        logger.dump_details();\n        pal::fprintf(stderr, W(\"END: coreclr_initialize failed - Error: 0x%08x\\n\"), result);\n        return -1;\n    }\n\n    if (coreclr_set_error_writer_func != nullptr)\n    {\n        coreclr_set_error_writer_func(nullptr);\n    }\n\n    int exit_code;\n    {\n        actions.before_execute_assembly(config.entry_assembly_fullpath);\n\n        result = coreclr_execute_func(\n            CurrentClrInstance,\n            CurrentAppDomainId,\n            config.entry_assembly_argc,","sourceCodeStart":597,"sourceCodeEnd":633,"githubUrl":"https://github.com/dotnet/runtime/blob/60108ba66eb7d1d12f595480091b4ad80a24b172/src/coreclr/hosts/corerun/corerun.cpp#L597-L633","documentation":"Printed by the corerun host immediately before dumping diagnostics when the CoreCLR runtime fails to initialize via coreclr_initialize. The HRESULT (0x%08x) identifies the specific failure (e.g. missing coreclr.dll, bad property, incompatible runtime). The BEGIN/END pair brackets the logger.dump_details() output so the user can find the detailed trace.","triggerScenarios":"Emitted at src/coreclr/hosts/corerun/corerun.cpp:615 when coreclr_init_func (the resolved coreclr_initialize export) returns a FAILED HRESULT. This happens if libcoreclr cannot be located via --clr-path/CORE_ROOT, the runtime binary is the wrong architecture, a TRUSTED_PLATFORM_ASSEMBLIES property is missing/malformed, or the runtime version mismatches the target assembly.","commonSituations":"Running corerun against a mismatched or partial CORE_ROOT (e.g. only coreclr.dll copied without the managed CLR assemblies), pointing --clr-path at a 32-bit runtime while executing a 64-bit corerun, passing a System.Runtime properties bag that omits required keys like TRUSTED_PLATFORM_ASSEMBLIES, or after a SDK/runtime upgrade that left stale paths.","solutions":["Check that CORE_ROOT or --clr-path points to a complete runtime layout containing both coreclr.dll/libcoreclr.so and the System.* managed assemblies.","Decode the printed HRESULT (e.g. 0x8007000b = ERROR_BAD_FORMAT, 0x80131700 = runtime init) using the HRESULT table in docs to find the root cause.","Re-run with the runtime's matching corerun binary (same bitness/architecture as the runtime).","If passing -p properties, verify TRUSTED_PLATFORM_ASSEMBLIES and APP_PATHS are correct and that every listed file exists."],"exampleFix":"// before\ncorerun -c /opt/wrong-runtime My.dll\n// after\ncorerun -c /opt/dotnet-shared/Microsoft.NETCore.App/8.0.0 My.dll","handlingStrategy":"validation","validationCode":"// Before invoking corerun, verify the runtime layout\n#include <filesystem>\nnamespace fs = std::filesystem;\nbool runtime_ok(const fs::path& clr_path) {\n    return fs::exists(clr_path / \"coreclr.dll\")  // or libcoreclr.so/.dylib\n        && fs::exists(clr_path / \"System.Private.CoreLib.dll\");\n}\nif (!runtime_ok(config.clr_path)) { return report_error(\"bad CORE_ROOT\"); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set CORE_ROOT to the matching runtime version directory.","Validate that coreclr native binary and System.Private.CoreLib.dll both exist before launch.","Match corerun bitness to the runtime bitness.","Pin the runtime version in CI to avoid drift."],"tags":["coreclr","corerun","runtime-initialization","host"],"backgroundTag":null,"analyzedSha":"60108ba66eb7d1d12f595480091b4ad80a24b172","analyzedAt":"2026-08-10T18:54:11.478Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}