{"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/290d5ab72cc1102813fbc0406fb186ceadabc340/src/coreclr/hosts/corerun/corerun.cpp#L597-L633","documentation":"Opening marker printed to stderr when the coreclr_initialize() call in run() returns a failing HRESULT (FAILED(result) is true). The host then dumps exe path, all runtime properties, managed assembly path, and arguments via logger.dump_details() before the matching END line. The 0x%08x is the raw CoreCLR HRESULT, which encodes the specific initialization failure reason.","triggerScenarios":"coreclr_init_func() is invoked with exePath, 'corerun', propertyCount, keys/values (TRUSTED_PLATFORM_ASSEMBLIES, APP_PATHS, NATIVE_DLL_SEARCH_DIRECTORIES, user properties, HOST_PROPERTY_RUNTIME_CONTRACT), and the runtime refuses to start. Common HRESULTs include 0x80070002 (file not found), 0x80131700 (framework init failure), 0x80004005 (unspecified).","commonSituations":"TRUSTED_PLATFORM_ASSEMBLIES list missing or pointing at non-existent mscorlib/System.Private.CoreLib; APP_PATHS or NATIVE_DLL_SEARCH_DIRECTORIES wrong; a user-defined property (-p key=value) has an invalid value; the entry assembly path is inaccessible; bitness mismatch between host and TPA assemblies.","solutions":["Read the HRESULT between BEGIN and END and decode it (e.g. 0x80070002 = ERROR_FILE_NOT_FOUND -> a TPA path is wrong).","Check the dumped 'Properties:' block, especially TRUSTED_PLATFORM_ASSEMBLIES, for missing/incorrect paths.","Confirm CORE_ROOT and CORE_LIBRARIES are set to directories that actually contain System.Private.CoreLib.dll and the rest of the BCL.","Remove or correct any -p user-defined properties and re-run; ensure the entry assembly exists and is a valid managed PE.","Set DOTNET_DIAGNOSTIC_PORTS / enable coreclr_set_error_writer output (already wired) to get the runtime's own diagnostic line."],"exampleFix":"# before: TPA list is empty because CORE_ROOT has no DLLs\nexport CORE_ROOT=/empty\ncorerun App.dll\n# after\nexport CORE_ROOT=/path/to/shared/Microsoft.NETCore.App/8.0.x\ncorerun App.dll","handlingStrategy":"validation","validationCode":"# validate TPA / CORE_ROOT before running\ntest -n \"$CORE_ROOT\" || { echo 'CORE_ROOT unset'; exit 1; }\ntest -f \"$CORE_ROOT/System.Private.CoreLib.dll\" || { echo 'missing System.Private.CoreLib.dll'; exit 1; }\nls \"$CORE_ROOT\"/*.dll >/dev/null 2>&1 || { echo 'CORE_ROOT has no TPA dlls'; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set CORE_ROOT to a directory containing System.Private.CoreLib.dll and the BCL assemblies.","Validate user-defined -p property keys/values against the runtime's accepted property list.","Capture the BEGIN/END block to file for offline HRESULT decoding.","Keep a HRESULT cheat-sheet handy (0x80070002=FILE_NOT_FOUND, 0x80131700=FX init, etc.)."],"tags":["coreclr","corerun","runtime-host","initialization","hresult"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}