{"record":{"id":"0a692e0eed749c82","repo":"Pumpkin-MC/Pumpkin","slug":"invalid-resource-location","errorCode":null,"errorMessage":"Invalid resource location","messagePattern":"Invalid resource location","errorType":"error_code","errorClass":"BossbarUpdateError","httpStatus":null,"severity":"error","filePath":"crates/pumpkin/src/world/custom_bossbar.rs","lineNumber":12,"sourceCode":"use crate::entity::player::Player;\nuse crate::server::Server;\nuse crate::world::bossbar::{Bossbar, BossbarColor, BossbarDivisions};\nuse pumpkin_util::text::TextComponent;\nuse rustc_hash::FxHashMap;\nuse std::sync::Arc;\nuse thiserror::Error;\nuse uuid::Uuid;\n\n#[derive(Debug, Error)]\npub enum BossbarUpdateError {\n    #[error(\"Invalid resource location\")]\n    InvalidResourceLocation(String),\n    #[error(\"No changes\")]\n    NoChanges(&'static str, Option<&'static str>),\n}\n\n/// Representing the stored custom boss bars from level.dat\n#[derive(Clone)]\npub struct CustomBossbar {\n    pub namespace: String,\n    pub bossbar_data: Bossbar,\n    pub max: i32,\n    pub value: i32,\n    pub visible: bool,\n    pub players: Vec<Uuid>,\n}\n\nimpl CustomBossbar {\n    #[deny(clippy::new_without_default)]","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/Pumpkin-MC/Pumpkin/blob/8d4639e25a57c15e47448ec327c780d41bbf2356/crates/pumpkin/src/world/custom_bossbar.rs#L1-L30","documentation":"BossbarUpdateError::InvalidResourceLocation, thrown by the custom bossbar update code when the bossbar's resource location (namespaced identifier) does not form a valid Minecraft resource location string. Custom boss bars are stored in level.dat and identified by namespaced keys.","triggerScenarios":"Updating/creating a custom bossbar with an identifier that is empty, lacks a namespace, or contains characters not allowed in a resource location (uppercase, spaces, invalid symbols, multiple colons).","commonSituations":"Datapack/config defines a bossbar key like 'MyBoss' or 'custom:my:boss'; hand-edited level.dat with a malformed key; plugin commands passing raw text instead of a namespaced id.","solutions":["Use a valid namespaced identifier: `namespace:path` with lowercase letters, digits, '_', '-', '.', '/' only","Add the default namespace explicitly (e.g. 'custom:my_bossbar' instead of 'my_bossbar')","Validate the resource location string before constructing/updating the bossbar"],"exampleFix":"// before\nlet id = \"My Boss!\";\n// after\nlet id = \"minecraft:my_boss\"; // or \"custom:my_boss\"","handlingStrategy":"validation","validationCode":"fn valid_resource_location(s: &str) -> bool {\n    let valid = |t: &str| !t.is_empty() && t.bytes().all(|b| b.is_ascii_lowercase() || b.is_ascii_digit() || matches!(b, b'_' | b'-' | b'.' | b'/'));\n    match s.split_once(':') { Some((ns, path)) => valid(ns) && valid(path), None => valid(s) }\n}","typeGuard":"fn is_valid_bossbar_id(s: &str) -> bool {\n    let parts: Vec<&str> = s.split(':').collect();\n    parts.len() <= 2 && parts.iter().all(|p| !p.is_empty() && p.chars().all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || \"_-./\".contains(c)))\n}","tryCatchPattern":"match bossbar.update(new_state) {\n    Err(BossbarUpdateError::InvalidResourceLocation(loc)) => log::error!(\"invalid bossbar id: {loc}\"),\n    Ok(()) => { /* proceed */ }\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Always use lowercase namespaced ids ('namespace:path') for bossbars","Sanitize user/datapack-supplied ids before creating entries","Validate level.dat bossbar keys at load time and log/skip malformed ones"],"tags":["rust","minecraft","resource-location","bossbar"],"backgroundTag":"invalid-identifier-format","analyzedSha":"8d4639e25a57c15e47448ec327c780d41bbf2356","analyzedAt":"2026-09-09T15:32:22.916Z","contentChangedAt":"2026-09-09T15:32:22.916Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}