{"record":{"id":"dfbf23d560d88583","repo":"Hmbown/CodeWhale","slug":"default-hotbar-slot-fits-in-u8","errorCode":null,"errorMessage":"default hotbar slot fits in u8","messagePattern":"default hotbar slot fits in u8","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/config/src/lib.rs","lineNumber":1390,"sourceCode":"                \"hotbar slot {slot} references unknown action '{action}'; keeping binding\"\n            ),\n        }\n    }\n}\n\n#[derive(Debug, Clone, PartialEq, Eq)]\npub struct HotbarConfigResolution {\n    pub bindings: Vec<HotbarBinding>,\n    pub warnings: Vec<HotbarConfigWarning>,\n}\n\n#[must_use]\npub fn default_hotbar_bindings() -> Vec<HotbarBinding> {\n    DEFAULT_HOTBAR_ACTIONS\n        .iter()\n        .enumerate()\n        .map(|(idx, action)| HotbarBinding {\n            slot: u8::try_from(idx + 1).expect(\"default hotbar slot fits in u8\"),\n            action: (*action).to_string(),\n            label: None,\n        })\n        .collect()\n}\n\n/// The default hotbar slots in on-disk (`[[hotbar]]`) form. Since #3807 an\n/// absent `hotbar` key means \"hidden\", so `/hotbar on` persists these explicit\n/// bindings rather than deleting the key. Kept in terms of\n/// [`default_hotbar_bindings`] so `DEFAULT_HOTBAR_ACTIONS` stays the single\n/// source of truth.\n#[must_use]\npub fn default_hotbar_bindings_toml() -> Vec<HotbarBindingToml> {\n    default_hotbar_bindings()\n        .into_iter()\n        .map(|binding| HotbarBindingToml {\n            slot: binding.slot,\n            action: binding.action,","sourceCodeStart":1372,"sourceCodeEnd":1408,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/config/src/lib.rs#L1372-L1408","documentation":"A compile-time-shaped invariant: default_hotbar_bindings() numbers slots 1..=DEFAULT_HOTBAR_ACTIONS.len(), and the expect asserts that count never exceeds u8's range. It fires only if someone adds more than 255 default hotbar actions — a code-change bug, not runtime input.","triggerScenarios":"Thrown at crates/config/src/lib.rs:1390 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Keep DEFAULT_HOTBAR_ACTIONS at 255 entries or fewer","Change HotbarBinding.slot to a wider integer type if the action list must grow"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}