Pumpkin-MC/Pumpkin · error · BossbarUpdateError

Invalid resource location

Error message

Invalid resource location

What it means

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.

Solutions

  1. Use a valid namespaced identifier: `namespace:path` with lowercase letters, digits, '_', '-', '.', '/' only
  2. Add the default namespace explicitly (e.g. 'custom:my_bossbar' instead of 'my_bossbar')
  3. Validate the resource location string before constructing/updating the bossbar

Example fix

// before
let id = "My Boss!";
// after
let id = "minecraft:my_boss"; // or "custom:my_boss"
Defensive patterns

Strategy: validation

Validate before calling

fn valid_resource_location(s: &str) -> bool {
    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'/'));
    match s.split_once(':') { Some((ns, path)) => valid(ns) && valid(path), None => valid(s) }
}

Type guard

fn is_valid_bossbar_id(s: &str) -> bool {
    let parts: Vec<&str> = s.split(':').collect();
    parts.len() <= 2 && parts.iter().all(|p| !p.is_empty() && p.chars().all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || "_-./".contains(c)))
}

Try / catch

match bossbar.update(new_state) {
    Err(BossbarUpdateError::InvalidResourceLocation(loc)) => log::error!("invalid bossbar id: {loc}"),
    Ok(()) => { /* proceed */ }
    Err(e) => return Err(e.into()),
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


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

Appendix: source

Thrown at crates/pumpkin/src/world/custom_bossbar.rs:12

use crate::entity::player::Player;
use crate::server::Server;
use crate::world::bossbar::{Bossbar, BossbarColor, BossbarDivisions};
use pumpkin_util::text::TextComponent;
use rustc_hash::FxHashMap;
use std::sync::Arc;
use thiserror::Error;
use uuid::Uuid;

#[derive(Debug, Error)]
pub enum BossbarUpdateError {
    #[error("Invalid resource location")]
    InvalidResourceLocation(String),
    #[error("No changes")]
    NoChanges(&'static str, Option<&'static str>),
}

/// Representing the stored custom boss bars from level.dat
#[derive(Clone)]
pub struct CustomBossbar {
    pub namespace: String,
    pub bossbar_data: Bossbar,
    pub max: i32,
    pub value: i32,
    pub visible: bool,
    pub players: Vec<Uuid>,
}

impl CustomBossbar {
    #[deny(clippy::new_without_default)]

View on GitHub (pinned to 8d4639e25a)