Home

Why does XMRig say "failed to initialize" with config.json?

XMRig can say “failed to initialize” because it cannot read your config.json, because a setting is wrong, or because the mining engine cannot start after loading it. The most useful clue is usually the message just before that line, so do not assume your configuration file is broken until you check the earlier output.

First, check which file XMRig is loading

XMRig is a separate mining program that runs on your computer, not inside your web browser. Its config.json file stores settings such as your mining pool, wallet address, and processor options.

You may have more than one copy of that file, especially after an update or when using a shortcut. Tell XMRig exactly which one to load.

On Windows, open Command Prompt in the XMRig folder and run:

xmrig.exe --config="C:\Mining\xmrig\config.json"

On Linux, you could run:

./xmrig --config="/home/you/xmrig/config.json"

Replace the example path with your real one. Quotes help when a folder name contains spaces.

If the output says the file cannot be opened, check that:

  • The file exists at that exact location.
  • Its name is not secretly config.json.txt.
  • Your user account has permission to read it.

Running as administrator is not the first fix for a missing or incorrectly named file.

Check the file’s structure and settings

JSON is a text format that uses named settings, quotation marks, commas, and brackets. A small editing mistake can stop XMRig from reading it.

Common problems include:

  • Missing commas between settings.
  • Missing closing braces or brackets.
  • Curly “smart quotes” copied from formatted text.
  • Values with the wrong type, such as "true" instead of true.
  • Windows paths containing unescaped backslashes inside the JSON file.

For a path inside JSON, use doubled backslashes, such as "C:\\Mining\\file", or forward slashes where supported.

For the safest formatting, use plain JSON without comments or trailing commas. If XMRig reports a line, column, or character position, inspect that spot and the line immediately before it.

Start with the sample configuration supplied with your XMRig version. Save a backup, then change only the settings you need. This helps avoid old options or accidentally misplaced settings.

Separate configuration errors from mining-engine errors

If XMRig reads the file and then reports something like randomx: failed to allocate memory, the problem is not necessarily JSON.

RandomX is Monero’s mining algorithm—the work your processor performs. Its fast mode uses a dataset of about 2,080 MB, plus additional memory. A low memory limit or other running programs can prevent initialization.

Close unnecessary programs and check available memory. If you changed processor, memory, OpenCL, or CUDA settings, restore the supplied defaults and test again. OpenCL and CUDA are systems used for graphics-card computing; errors mentioning them point toward that part of your setup.

A huge-pages warning alone does not always stop mining. Huge pages are a memory feature that can improve performance.

The bottom line

Read the lines before “failed to initialize,” explicitly select your configuration file, and test a minimally edited sample from the same XMRig version. If you need help, share your XMRig version and the nearby error lines—not just the final message—and remove passwords, access tokens, and other private details first.

All 1,000 questions

MyAiMiner.com

MyAiMiner.com — Monero mining blog. 1,000 questions. Clear answers.

Monero (XMR) Mining BLOG

Hashes0
Blocks accepted0
Blocks rejected0
Runtime00:00:00