{"record":{"id":"d0ee487151e4381b","repo":"dotnet/runtime","slug":"error-fail-to-pal-initialize-n-d0ee48","errorCode":null,"errorMessage":"Error: Fail to PAL_Initialize\\n","messagePattern":"Error: Fail to PAL_Initialize\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/coreclr/tools/superpmi/superpmi/superpmi.cpp","lineNumber":236,"sourceCode":"\n#include \"jitmetadatalist.h\"\n\n    fw.Print(\"\\n\");\n}\n\n// Run superpmi. The return value is as follows:\n// 0    : success\n// -1   : general fatal error (e.g., failed to initialize, failed to read files)\n// -2   : JIT failed to initialize\n// 1    : there were compilation failures\n// 2    : there were asm diffs\n// 3    : there were missing values in method context\nint __cdecl main(int argc, char* argv[])\n{\n#ifdef TARGET_UNIX\n    if (0 != PAL_Initialize(argc, argv))\n    {\n        fprintf(stderr, \"Error: Fail to PAL_Initialize\\n\");\n        return (int)SpmiResult::GeneralFailure;\n    }\n#endif // TARGET_UNIX\n\n    Logger::Initialize();\n\n    SimpleTimer st1;\n    SimpleTimer st2;\n    SimpleTimer st3;\n    SimpleTimer st4;\n    st2.Start();\n    JitInstance* jit = nullptr;\n    JitInstance* jit2 = nullptr;\n    MethodStatsEmitter* methodStatsEmitter = nullptr;\n\n#ifdef SuperPMI_ChewMemory\n    // Chew up the base 2gb of memory on x86... helpful in finding any places where classhandles etc are de-ref'd\n    SYSTEM_INFO sSysInfo;","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/dotnet/runtime/blob/60108ba66eb7d1d12f595480091b4ad80a24b172/src/coreclr/tools/superpmi/superpmi/superpmi.cpp#L218-L254","documentation":"The main superpmi replay/comparison tool calls PAL_Initialize(argc,argv) on unix at the start of main. A non-zero return means the PAL could not be brought up, so the tool prints this and returns SpmiResult::GeneralFailure (-1) without touching any method-context files. It is the top-level fatal for the superpmi CLI.","triggerScenarios":"Running the superpmi binary on unix where PAL_Initialize fails: PAL/runtime sibling libraries missing next to the binary, arch mismatch, locale/proc issues, or signal registration blocked. Equivalent root cause to the mcs/mcs.cpp variant but in the superpmi orchestrator.","commonSituations":"Invoking superpmi from outside its artifacts/bin directory; using a binary built for another OS/arch; minimal containers lacking locale or /proc; branch-switched build trees with partial artifacts.","solutions":["Run superpmi from its artifacts/bin/<arch>.<flavor> directory so PAL/runtime files resolve.","Rebuild for the exact target OS/arch and keep the artifacts tree intact.","Install/fix locales and verify /proc is mounted.","strace -f superpmi ... to capture the first failing PAL syscall (usually an open/mmap of a runtime module)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\nset -euo pipefail\nBIN=\"${1:?superpmi path required}\"\nldd \"$BIN\" 2>/dev/null | grep -q 'not found' && exit 1\nfile \"$BIN\" | grep -qi \"$(uname -m)\" || exit 1\nlocale -a >/dev/null 2>&1 || echo \"warning: locales missing\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Invoke superpmi from its artifacts/bin directory so PAL/runtime siblings resolve.","Rebuild for the exact target OS/arch and keep the tree intact.","Keep locales installed and /proc mounted in the host.","strace superpmi to capture the first failing PAL syscall."],"tags":["superpmi","superpmi-main","pal","initialization","unix","developer-tool"],"backgroundTag":null,"analyzedSha":"60108ba66eb7d1d12f595480091b4ad80a24b172","analyzedAt":"2026-08-10T18:54:11.478Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}