Errors on a Minecraft server can be extremely scary and frustrating; are you about to lose 100+ hours of work, or is it just something you can fix quick and get right back into it? One of the scariest are chunk file location errors – what to do?!

Thankfully there’s an app for that.

So today was a routine day for Windows 7 – the good ol’ Blue Screen of Death first thing in the morning. A million Windows versions and updates and still the same old rigamarole… UGH.

Normally BSODs are generally horrible, but when they rip your computer into a powerless void sometimes you can lose data that your computer was in the middle of writing. Without fail my Tekkit Lite server seems to re-write chunk files into the wrong location.

So, how do we fix this?

## Diagnosing

The first thing you want to do is look in your server log – if you see a ton of spam that looks like this, then you have a chunk location error and you’re gonna have to get your hands dirty (a little – I’ll try and make it painless)

2013-02-13 09:40:09 [INFO] [STDOUT] Chunk file at -37,3 is in the wrong location; relocating. (Expected -37, 3, got -37, 9)
...
... (and then sometime later)
...
2013-02-13 10:07:20 [INFO] [STDOUT] Wrong location! qn['Skeleton'/23872, l='world', x=-582.50, y=4.00, z=56.50]
2013-02-13 10:07:20 [INFO] [STDERR] java.lang.Exception: Stack trace
2013-02-13 10:07:20 [INFO] [STDERR] at java.lang.Thread.dumpStack(Unknown Source)
...
... (repeat one or two BAJILLION times... like, seriously?)


So if you see something like “Chunk file at xx,xx is in the wrong location; relocating. (Expected xx, xx, got yy, yy)” you’re going to have really two options:

• Delete the Chunk
• Replace the Chunk from a server backup

Your best option is always going to be to replace the chunk with a backup; so hopefully you’ve been regularly backing up your server. I tend to back ours up daily because I know how reliable Windows is NOT.

## Triage (Assessing the Damage)

So what chunk is actually wrong? What is in it? Will deleting it ruin everything you worked on? To answer this question you get do some math. This step is optional and either confirms the doom and gloom, or gives sweet relief. For us it was relief

First, take a look at the Chunk location the error is mentioning (see above); for this example it was the Chunk located -37, 3. Now those numbers are in Chunk coordinates so to get to player coordinates we are going to have to multiply by 16 (use a calc if your math skills rival ChiefDiesel’s electrical prowess).

To help figure out which direction the chunk actually lies, and what it contains, you can use the “Wrong Location! … zomg mobs gone wild” coordinates. The server was complaining about a skeleton at -582, 56 so we need to verify that our chunk math contains the point -582, 56 since we know that one is bad. The image below shows sweet little png of the math I did for our chunk location error.

So, what’s inside the chunk?

• Meh, pretty much nothing ‘cept some sweet shrubs I planted
• Lucky for you. You can either delete the dumb thing, or try and replace it with an older version from the backup
• OH NOES, IT’s MAH BASE! THE WHOLE THING!
• Srsly? Who has a base that small? Well you better have been backing up your server/world… (e.g. copying the folder every once in a while)

## Fixing the Chunk

Ok so at this point you should have an idea of what’s in the bad chunk (in case you need to go back and add your machines in again). Even more hopefully you’ve BACKED UP the server prior to the crash.

For us there was nothing important in the chunk, but I’d still rather replace it with chunks from the backup just in case.

1. You probably already did this, but just make sure your server is NOT running…
2. BACK UP YOUR WHOLE SERVER FOLDER
1. Yeah I know it’s got issues just now, but at least the whole thing isn’t corrupt. What’s easier, rebuilding a 16×16 square of your base, or your entire world?
2. I typically ZIP the server folder and rename it with a timestamp (e.g. “Tekkit Lite Server –  v0.5.7 – 2013 02 13 at 1031am.ZIP” )
1. The link above is for a stable version compatible with MC 1.4.7. If you’re running a later version, or this post is way out of date, or you want to oogle the source code – click here and get a different version
4. Open the command prompt
1. Windows -> Start -> Run -> cmd.exe
2. (alternatively) <windows-key>+<r>, then type cmd and hit <enter>
5. In the command prompt (henceforth, cmd), navigate (change directory) to the Region Fixer folder (the one you just unzipped) with the cd command
1. If you’re lazy like me then you can do a sweet shortcut by first typing cd then dragging and dropping the Region Fixer folder into the cmd window to have Windows type the whole path for you – woot!
6. Next type region-fixer.exe –help to see the available options
7. Type region-fixer.exe “C:Pathtoyourserver folderworld” to have Region Fixer check for issues. The results should match with the errors you were seeing in your server log; i.e. 1 chunk in wrong location.
8. Now it’s go-time.
1. If you have a backup (e.g. a folder copy of your server or world from before the crash) you can call Region Fixer again, passing it the –rw parameter (to make it replace wrong chunk) and the  –backups=”C:PathtotheBack Upserverworld” parameter to make it use a previous version for the relocation.
1. CAUTION: This is the safer of the two options, but if your server backup is really old you might lose stuff you built inside the chunk.
2. If you don’t have a backup anywhere, you’re going to have to use the –dw parameter, ouch :/
1. CAUTION: This will DELETE wrong located chunks (they will regenerate as fresh chunks when you log in again), and you will LOSE ERRYYYTHING you had built inside the chunk.
9. DONE! At this point you should be all set. Region Fixer should have either deleted or replaced the chunk(s) and you can go ahead and re-launch your server. You should see a nice clean, error-free, server log (ignoring the normal mod loading spam) – all the chunks happily in the right places!

## Note on Region-Fixer parameters

All the parameters typed out in this tutorial use a double dash denotation (two dashes in a row) but for some reason the font, or WordPress itself, make it look like a single line. It’s not.

To dramatize this… the –rw parameter from before should contain two dashes, like this:

--rw

I would have used the preformatted font style everywhere but WordPress doesn’t play nice.

## Credit

The Region Fixer tool used in this tutorial is clearly awesome and thanks and donations should go to Fenixin

The tutorial here was put together entirely by us (The Mindcrafters) so if you found it helpful, or thought some points could use clarification please let us know!

Happy Chunking.

### 7 Responses to “Minecraft Chunk File in the Wrong Location”

I’m having trouble with step #5. When i type in “cd” nothing happens. I tried typing “change directory but it just says CHANGE PLEASE help me! I have a Windows 8 computer now but it’s not one of those new ones. I have a normal laptop with windows 8 installed. I really put a lot of work into this server! Help!

OK let’s get you back up and running!

Make sure to open the command prompt first (Start->Run-> “cmd”) then when the window comes up you need to to change the directory. To get it to change you have to issue the “cd” command like so
 cd C:\path\to\the\folder 

If your username or any folders along the way have spaces in them you need to do the following
cd "C:\path\to\the\folder with\spaces\"

Give that a try and let me know how it goes!

So I’m confused on step #8. I don’t have a back up so I have to go the –dw route. What do I do exactly from that point on? What do I have to type in?

Step 8 without a back up:

(sorry my english, I hope you understand me)

the command is: region-fixer.exe –rw (and here the direcction of your server folder)