{"record":{"id":"0b2a5f4b77e71456","repo":"dotnet/runtime","slug":"failed-to-initialize-assembler","errorCode":null,"errorMessage":"Failed to initialize Assembler\n","messagePattern":"Failed to initialize Assembler\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/coreclr/ilasm/main.cpp","lineNumber":605,"sourceCode":"                {\n                    fprintf(stderr,\"Invalid Image Base specified for 32-bit target\\n\");\n                    delete pAsm;\n                    goto ErrorExit;\n                }\n            }\n            if (COR_IS_32BIT_PREFERRED(pAsm->m_dwComImageFlags) &&\n                ((pAsm->m_dwCeeFileFlags & ICEE_CREATE_FILE_PE64) ||\n                 ((pAsm->m_dwCeeFileFlags & ICEE_CREATE_FILE_PE32) == 0) ||\n                 ((pAsm->m_dwCeeFileFlags & ICEE_CREATE_MACHINE_I386) == 0) ||\n                 ((pAsm->m_dwComImageFlags & COMIMAGE_FLAGS_ILONLY) == 0)))\n            {\n                fprintf(stderr,\"/32BITPREFERRED valid only with PE32/X86/ILONLY images\\n\");\n                delete pAsm;\n                goto ErrorExit;\n            }\n            if (!pAsm->Init(bGeneratePdb))\n            {\n                fprintf(stderr,\"Failed to initialize Assembler\\n\");\n                delete pAsm;\n                goto ErrorExit;\n            }\n            if(g_dwTestRepeat)\n                MakeTestFile(szInputFilename);\n\n            if(wzOutputFilename[0] == 0)\n            {\n                wcscpy_s(wzOutputFilename,MAX_FILENAME_LENGTH,pwzInputFiles[0]);\n                size_t j = u16_strlen(wzOutputFilename);\n                do\n                {\n                    j--;\n                    if(wzOutputFilename[j] == W('.'))\n                    {\n                        wzOutputFilename[j] = 0;\n                        break;\n                    }","sourceCodeStart":587,"sourceCodeEnd":623,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/coreclr/ilasm/main.cpp#L587-L623","documentation":"`pAsm->Init(bGeneratePdb)` returned FALSE (main.cpp:603-605). Assembler::Init (assem.cpp:235) creates the ICeeFileGen, the .il/.sdata/.tls sections, and (on Linux) checks OpenSSL for deterministic mode; any of those HRESULTs failing causes Init to return FALSE and ilasm prints this generic message and exits. The root cause is one of those internal setup failures.","triggerScenarios":"ICeeFileGen creation failure; section-creation failure; (Linux) OpenSSL unavailable in deterministic mode; out of resources during metadata emitter setup.","commonSituations":"Corrupted or incompatible ilasm/CoreCLR build; missing native dependency; very low memory; deterministic mode without OpenSSL (see 221).","solutions":["Check stderr for a preceding, more specific message (e.g. the OpenSSL line from 221).","Reinstall or rebuild ilasm from a known-good source tree.","Free system resources / try on a different machine to rule out memory pressure.","Disable `/DETERMINISTIC` and `/PDB` to narrow which setup step failed."],"exampleFix":"// before\nilasm /DETERMINISTIC /PDB foo.il   # -> Failed to initialize Assembler\n// after\napt-get install -y libssl1.1 && ilasm /DETERMINISTIC /PDB foo.il","handlingStrategy":"validation","validationCode":"# Pre-flight the conditions Assembler::Init depends on.\n# (Linux, deterministic) ensure OpenSSL loads; ensure free memory.\nif want_deterministic && ! ldd \"$(command -v ilasm)\" | grep -q libcrypto; then\n  echo 'Init will likely fail: OpenSSL missing for deterministic mode'; exit 1\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Watch for the specific preceding message (e.g. OpenSSL) in stderr.","Keep ilasm and its native deps from the same build.","Smoke-test ilasm on a trivial .il before real builds."],"tags":["ilasm","initialization","native-dependency","setup-failure"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}