louis-e/arnis · error · BedrockSaveError

'{}' already exists and was not created by Arnis. Rename or

Error message

'{}' already exists and was not created by Arnis. Rename or move it, or choose a different Bedrock save path.

What it means

When generating a Bedrock world, prepare_output_dir prepares the staging/output directory. If the directory already exists but is not recognized as an Arnis staging directory (is_arnis_staging_dir returns false), it refuses to touch it and returns BedrockSaveError::Io with ErrorKind::AlreadyExists and this message — protecting user data (a real save or unrelated folder) from being overwritten. Callers write_world and parallel_chunk_encode_writes_expected_records propagate this error.

Source

Thrown at src/world_editor/bedrock.rs:219

        emit_gui_progress_update(92.0, "Saving Bedrock world...");
        self.write_chunks_to_db(world)?;

        emit_gui_progress_update(97.0, "Saving Bedrock world...");
        self.write_metadata(world, xzbbox, llbbox)?;

        emit_gui_progress_update(98.0, "Saving Bedrock world...");
        self.package_mcworld()?;

        emit_gui_progress_update(99.0, "Saving Bedrock world...");
        self.cleanup_temp_dir()?;
        Ok(())
    }

    /// Prepares the staging directory, reusing leftovers but never deleting foreign data.
    fn prepare_output_dir(&self) -> Result<(), BedrockSaveError> {
        if self.output_dir.exists() {
            if !is_arnis_staging_dir(&self.output_dir) {
                return Err(BedrockSaveError::Io(std::io::Error::new(
                    std::io::ErrorKind::AlreadyExists,
                    format!(
                        "'{}' already exists and was not created by Arnis. \
                         Rename or move it, or choose a different Bedrock save path.",
                        self.output_dir.display()
                    ),
                )));
            }
            fs::remove_dir_all(&self.output_dir)?;
        }
        if self.mcworld_path.exists() {
            fs::remove_file(&self.mcworld_path)?;
        }

        fs::create_dir_all(&self.output_dir)?;
        fs::write(self.output_dir.join(STAGING_MARKER), b"")?;
        // db directory will be created by LevelDB
        Ok(())

View on GitHub (pinned to 34048924d9)

Solutions

  1. Pick a different output directory or rename the target path before generating
  2. Manually move/rename or delete the existing directory if you are sure it is not needed (back up real saves first)
  3. If the directory is a leftover from a crashed Arnis run whose marker was lost, move it aside manually — Arnis will never delete foreign-looking data itself
  4. Check the path for typos (e.g. pointing at minecraftWorlds instead of a fresh folder)
  5. Re-run generation after clearing the path; if it's a previous Arnis output you want to overwrite, remove the whole staging directory

Example fix

// before: output points at an existing world
output_dir = "/home/user/.minecraft/com.mojang/minecraftWorlds/MyWorld"
// after: use a fresh, non-existent path
output_dir = "/home/user/.minecraft/com.mojang/minecraftWorlds/arnis-city-2026-09-03"
Defensive patterns

Strategy: validation

Validate before calling

fn output_path_is_free(dir: &std::path::Path) -> Result<(), String> {
    if dir.exists() {
        Err(format!(
            "'{}' already exists — rename/move it or pick another Bedrock save path",
            dir.display()
        ))
    } else { Ok(()) }
}
// call before invoking write_world / generation

Try / catch

match editor.write_world() {
    Ok(()) => println!("World written"),
    Err(BedrockSaveError::Io(e)) if e.kind() == std::io::ErrorKind::AlreadyExists => {
        eprintln!("Target exists and is not an Arnis staging dir: {e}");
        // prompt user for a different path, do not delete anything
    }
    Err(e) => eprintln!("Bedrock export failed: {e}"),
}

Prevention

When it happens

Trigger: Calling write_world with an output_dir path that already exists on disk and was not created by Arnis — e.g. pointing at an existing Minecraft Bedrock save folder, an existing world you exported before with another tool, or any leftover directory lacking Arnis's staging marker.

Common situations: Choosing the same Bedrock save path as an existing world in the GUI; re-running generation after a partially deleted previous run where the Arnis marker file was removed; pointing output at a directory like Minecraft's com.mojang/minecraftWorlds/<existing world>; two generation runs racing on the same path.

Related errors


AI-assisted analysis of louis-e/arnis@34048924d9 (2026-09-03). Data as JSON: /api/errors/b77ebdfeb18fbfda. Report an issue: GitHub.