{"record":{"id":"7198a4dd3e4a5411","repo":"Pumpkin-MC/Pumpkin","slug":"missing-required-field-0","errorCode":null,"errorMessage":"Missing required field: {0}","messagePattern":"Missing required field: (.+?)","errorType":"error_code","errorClass":"TemplateError","httpStatus":null,"severity":"error","filePath":"crates/pumpkin-world/src/generation/structure/template/structure_template.rs","lineNumber":22,"sourceCode":"//! into a runtime representation with palettes, entities, block info, and transformations.\n\nuse std::io::Cursor;\n\nuse pumpkin_data::{Mirror, Rotation};\nuse pumpkin_nbt::{compound::NbtCompound, nbt_compress::read_gzip_compound_tag, tag::NbtTag};\nuse pumpkin_util::math::{block_box::BlockBox, vector3::Vector3};\nuse thiserror::Error;\n\nuse super::processor::StructureProcessor;\nuse crate::generation::structure::structures::jigsaw::JigsawJointType;\n\n/// Errors that can occur when loading or saving a structure template.\n#[derive(Debug, Error)]\npub enum TemplateError {\n    #[error(\"Failed to decompress NBT: {0}\")]\n    NbtError(#[from] pumpkin_nbt::Error),\n\n    #[error(\"Missing required field: {0}\")]\n    MissingField(&'static str),\n\n    #[error(\"Invalid field type for {0}\")]\n    InvalidFieldType(&'static str),\n\n    #[error(\"Invalid palette index: {0}\")]\n    InvalidPaletteIndex(u32),\n}\n\n/// Settings used when placing, transforming, or querying a [`StructureTemplate`].\n#[derive(Clone, Debug)]\npub struct StructurePlaceSettings {\n    pub mirror: Mirror,\n    pub rotation: Rotation,\n    pub rotation_pivot: Vector3<i32>,\n    pub bounding_box: Option<BlockBox>,\n    pub ignore_entities: bool,\n    pub apply_waterlogging: bool,","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/Pumpkin-MC/Pumpkin/blob/8d4639e25a57c15e47448ec327c780d41bbf2356/crates/pumpkin-world/src/generation/structure/template/structure_template.rs#L4-L40","documentation":"Variant `MissingField` of `TemplateError` in pumpkin-world's structure template loader. It is thrown when a structure template's NBT is readable but lacks a required field (e.g. `size`, `palette`, `blocks`, `entities`) expected by the template schema.","triggerScenarios":"Parsing a structure template NBT that parses successfully but omits a required key the `StructureTemplate` deserializer demands.","commonSituations":"Hand-crafted or third-party-exported structure files missing fields, structure files from older game versions with different schemas, truncated custom datapack structures.","solutions":["The error names the missing field — add it to the template NBT with a valid value","Re-export the structure in-game so all required fields are written","Compare the file's fields against the vanilla structure template schema"],"exampleFix":"// before: template NBT missing a key\n{ \"palette\": [...], \"blocks\": [...] }\n// after: include required fields\n{ \"size\": [3, 3, 3], \"palette\": [...], \"blocks\": [...], \"entities\": [] }","handlingStrategy":"validation","validationCode":"const REQUIRED: &[&str] = &[\"size\", \"palette\", \"blocks\"];\n// after NBT parse, before constructing StructureTemplate:\nfor key in REQUIRED {\n    if template_nbt.get(key).is_none() { return Err(format!(\"template missing {key}\")); }\n}","typeGuard":"fn template_has_required_fields(nbt: &NbtMap) -> bool {\n    [\"size\", \"palette\", \"blocks\"].iter().all(|k| nbt.contains_key(*k))\n}","tryCatchPattern":"match StructureTemplate::load(path) {\n    Err(TemplateError::MissingField(f)) => error!(\"structure {path} missing field {f}\"),\n    other => other?,\n}","preventionTips":["Export structures in-game rather than hand-writing NBT","Validate template files against the schema before shipping datapacks","Keep structure assets and server versions aligned"],"tags":["structure-templates","nbt","missing-field","schema"],"backgroundTag":"missing-required-config-field","analyzedSha":"8d4639e25a57c15e47448ec327c780d41bbf2356","analyzedAt":"2026-09-09T15:32:22.916Z","contentChangedAt":"2026-09-09T15:32:22.916Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}