Pumpkin-MC/Pumpkin · critical

Wasm chunk generation phase failed for generator

Error message

Wasm chunk generation phase failed for generator {generator_id}: {error}

What it means

When a WASM world-generator plugin completes a chunk-generation phase, the host awaits the result and panics if it returned an Err. The panic message embeds the generator's ID and the underlying error, and it aborts the chunk-generation task (running on the rayon pool). This converts any generator failure — plugin trap, WIT error, or host callback failure — into an unrecoverable panic for that generation task.

Solutions

  1. Read the embedded {error} to find the failing plugin (generator_id) and fix or remove that plugin's generator
  2. Update the worldgen plugin to the server's plugin API version and retest on a test world
  3. Wrap the generator's phase logic in the plugin with error handling so it returns recoverable errors instead of trapping
  4. Host-side: replace the panic with disabling the offending generator and logging, so the server keeps running

Example fix

// before
            if let Err(error) = result {
                panic!("Wasm chunk generation phase failed for generator {generator_id}: {error}");
            }
// after
            if let Err(error) = result {
                log::error!("disabling generator {generator_id}: phase failed: {error}");
                return; // fall back to default generation for this chunk
            }
Defensive patterns

Strategy: try-catch

Validate before calling

// host-side guard before scheduling generation
if !plugin_is_healthy(generator_id) {
    log::warn!("generator {generator_id} failed health check; skipping");
    return default_generation(chunk);
}

Try / catch

match std::panic::catch_unwind(|| generator.generate_chunk(chunk)) {
    Ok(result) => result,
    Err(_) => {
        log::error!("generator {generator_id} panicked; using default generation");
        default_generation(chunk)
    }
}

Prevention

When it happens

Trigger: A plugin's chunk generation phase (init/populate/finish styled phases invoked per generator_id) returns an error: the WASM module traps, a guest export returns Err, or a host-side callback invoked during generation fails; generation runs off the tokio runtime on rayon, so the panic propagates through the chunk-gen worker.

Common situations: A buggy worldgen plugin throwing/trapping in its generator code; plugin panics on unusual terrain data (e.g. out-of-range biome/block IDs); plugin built against a mismatched worldgen API version.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of Pumpkin-MC/Pumpkin@8d4639e25a (2026-09-09). Data as JSON: /api/errors/0529d77edbf4ee58. Report an issue: GitHub.

Appendix: source

Thrown at crates/pumpkin/src/plugin/loader/wasm/wasm_host/wit/v0_1/world.rs:2323

                        let (buffer_resource, buffer_rep) = guest.with(|mut store| {
                            let resource = store.data_mut().add_chunk_buffer(chunk_buffer)?;
                            let rep = resource.rep();
                            Ok::<_, wasmtime::Error>((resource, rep))
                        })?;
                        let result = guest
                            .call(function, (generator_id, phase, buffer_resource))
                            .await;
                        guest.with(|mut store| {
                            let _ = store.data_mut().resource_table.delete::<
                                crate::plugin::loader::wasm::wasm_host::state::ChunkBufferResource,
                            >(wasmtime::component::Resource::new_own(buffer_rep));
                        });
                        result
                    })
                })
                .await;
            if let Err(error) = result {
                panic!("Wasm chunk generation phase failed for generator {generator_id}: {error}");
            }
        };

        // Tokio runtime probably won't be available since chunk gen happens on rayon
        if tokio::runtime::Handle::try_current().is_ok() {
            tokio::task::block_in_place(|| {
                self.server.runtime.block_on(run);
            });
        } else {
            self.server.runtime.block_on(run);
        }
    }
}

impl pumpkin_world::generation::generator::CustomChunkGenerator for WasmChunkGenerator {
    fn dimension(&self) -> &pumpkin_data::dimension::Dimension {
        &self.dimension
    }

View on GitHub (pinned to 8d4639e25a)