# A mod's configuration file could not be read

Forge or NeoForge could not parse a mod's TOML configuration file, because a line in it is not valid TOML.

- Code: `config_load_failed`
- Severity: error
- Category: Configuration
- Server types: Forge, NeoForge
- Page: https://failures.perland.online/failures/config_load_failed/

## Example log

```text
[11:20:03] [main/ERROR] [minecraft/Main]: Failed to start the minecraft server
net.minecraftforge.fml.config.ConfigFileTypeHandler$ConfigLoadingException: Failed loading config file waystones-common.toml of type COMMON for modid waystones
	at net.minecraftforge.fml.config.ConfigFileTypeHandler.lambda$reader$1(ConfigFileTypeHandler.java:47)
Caused by: com.electronwill.nightconfig.core.io.ParsingException: Invalid bare key: max Distance
```

## Parameters

| Parameter | Meaning |
| --- | --- |
| `file` | The configuration file the loader could not read, such as `waystones-common.toml`. |
| `mod` | The mod id the file belongs to (`forge` for Forge's own files). |

## Log lines this page covers

- `ConfigFileTypeHandler$ConfigLoadingException: Failed loading config file <file> of type <TYPE> for modid <mod>`

## What it means

Forge and NeoForge mods keep their settings in TOML files: `config/<mod>-common.toml` for settings shared by both sides, and `<mod>-server.toml` for server settings, which sits in `world/serverconfig/` (or in `defaultconfigs/`, which new worlds copy). The loader reads each file with a TOML parser. When a line breaks TOML's rules, the parser stops and the loader prints `ConfigLoadingException` with the file and the mod; the `Caused by:` line below it says what the parser did not accept.

When this happens while the server starts, the server usually stops. The loader also watches the files while the server runs, and reloads one that changes on disk; a file saved with a mistake then fails to reload and the mod keeps its previous settings.

## Why it happens

- **A hand edit broke the syntax.** A missing quote or bracket, a space in a key, a value without `=`, or text pasted into the wrong place.
- **A section appears twice.** The same `[section]` header was pasted in a second time ("has been declared twice").
- **The file was cut short or damaged,** for example when the disk filled up or the server was killed while writing it.
- **A file from another version or mod** was copied over this one.

## How to fix

1. Make a copy of the file named in `file` before changing anything.
2. Read the `Caused by:` line: it names the problem and often the text the parser stopped at. Open the file and fix that line. Values that are text need quotes (`name = "Spawn"`), numbers and `true` / `false` do not.
3. Check the file with any TOML validator if you cannot see the mistake.
4. If you cannot repair it, move the file out of the folder (keep the copy) and start the server: the mod writes a new file with its default values. Then copy your settings over from the old one, a few at a time.
5. Server files (`<mod>-server.toml`) live in `world/serverconfig/`; a fix there applies to that world only. Fix the copy in `defaultconfigs/` too if there is one.

## In Perland

The issue appears in the server's Diagnosis tab with the file and the mod it belongs to. Fix the file in the Files tab, which also reaches `world/serverconfig/`. On a server whose mods come from a modpack, a file the pack holds is copied over the server's at each start, so fix it in Mod Studio's config editor instead: it opens the pack's files under `config/` and `defaultconfigs/` and shows the default file from the mod's jar for comparison.

## References

- [Forge documentation: configuration](https://docs.minecraftforge.net/en/latest/misc/config/)
- [NeoForge documentation: configuration](https://docs.neoforged.net/docs/misc/config)
