{"record":{"id":"4eeeea0928216469","repo":"embassy-rs/embassy","slug":"standard-filter-slot-too-high","errorCode":null,"errorMessage":"Standard Filter Slot Too High!","messagePattern":"Standard Filter Slot Too High!","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-stm32/src/can/fd/filter.rs","lineNumber":273,"sourceCode":"            10 => StandardFilterSlot::_10,\n            11 => StandardFilterSlot::_11,\n            12 => StandardFilterSlot::_12,\n            13 => StandardFilterSlot::_13,\n            14 => StandardFilterSlot::_14,\n            15 => StandardFilterSlot::_15,\n            16 => StandardFilterSlot::_16,\n            17 => StandardFilterSlot::_17,\n            18 => StandardFilterSlot::_18,\n            19 => StandardFilterSlot::_19,\n            20 => StandardFilterSlot::_20,\n            21 => StandardFilterSlot::_21,\n            22 => StandardFilterSlot::_22,\n            23 => StandardFilterSlot::_23,\n            24 => StandardFilterSlot::_24,\n            25 => StandardFilterSlot::_25,\n            26 => StandardFilterSlot::_26,\n            27 => StandardFilterSlot::_27,\n            _ => panic!(\"Standard Filter Slot Too High!\"),\n        }\n    }\n}\n\n/// Extended Filter Slot\n#[derive(Debug, Copy, Clone, Eq, PartialEq)]\npub enum ExtendedFilterSlot {\n    /// 0\n    _0 = 0,\n    /// 1\n    _1 = 1,\n    /// 2\n    _2 = 2,\n    /// 3\n    _3 = 3,\n    /// 4\n    _4 = 4,\n    /// 5","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-stm32/src/can/fd/filter.rs#L255-L291","documentation":"StandardFilterSlot::from is generated for slots 0..=27; any index outside that range panics with 'Standard Filter Slot Too High!'. This guards against addressing a standard CAN filter bank slot beyond the 28 entries the bxCAN/FDCAN standard filter list provides in embassy-stm32's fd filter module.","triggerScenarios":"Constructing a StandardFilterSlot from a numeric index >= 28 (or negative, via an unhandled value) when configuring standard CAN ID filters, e.g. computing slot indices from a loop or config value that overruns the 28-slot table.","commonSituations":"Programmatically assigning filters to slots with an off-by-one loop bound; loading a filter count from configuration that exceeds 28; reusing extended-filter slot indices (up to a larger count) for standard filters.","solutions":["Clamp or validate filter slot indices to 0..=27 before constructing StandardFilterSlot","Reduce the number of standard filters configured to at most 28, or move surplus filters to the extended filter bank","Check loop bounds and configuration parsing so slot indices never exceed 27"],"exampleFix":"// before\nlet slot = StandardFilterSlot::from(idx); // idx may be >= 28\n// after\nassert!(idx < 28, \"standard filter slot {} out of range 0..28\", idx);\nlet slot = StandardFilterSlot::from(idx);","handlingStrategy":"validation","validationCode":"// Rust\nfn valid_standard_slot(idx: usize) -> Option<usize> {\n    if idx < 28 { Some(idx) } else { None }\n}","typeGuard":"// Rust\nfn in_standard_slot_range(idx: usize) -> bool { idx <= 27 }","tryCatchPattern":"// Rust: validate before constructing; in debug builds an assert!(idx <= 27) before StandardFilterSlot::from(idx) surfaces bad loop bounds early.","preventionTips":["Bound filter loops at 0..28 for standard filters","Never reuse extended-filter indices for standard slots","Validate config-supplied filter counts against 28"],"tags":["embedded","stm32","can","fdcan","filter","panic"],"backgroundTag":"value-out-of-range","analyzedSha":"463a07b963419a1bfe61d5d597c44acb810afb8b","analyzedAt":"2026-09-10T13:38:26.660Z","contentChangedAt":"2026-09-10T13:38:26.660Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}