{"record":{"id":"7ca608aea210f37e","repo":"embassy-rs/embassy","slug":"invalid-gpio-port-index","errorCode":null,"errorMessage":"Invalid GPIO port index {}","messagePattern":"Invalid GPIO port index (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-imxrt/src/gpio.rs","lineNumber":446,"sourceCode":"\n            // Enable pin interrupt on GPIO INT A\n            pin.block()\n                .intena(pin.port())\n                .modify(|r, w| unsafe { w.int_en().bits(r.int_en().bits() | (1 << pin.pin())) });\n        });\n\n        Self { pin: pin.into() }\n    }\n}\n\nimpl Future for InputFuture<'_> {\n    type Output = ();\n\n    fn poll(self: FuturePin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {\n        // We need to register/re-register the waker for each poll because any\n        // calls to wake will deregister the waker.\n        if self.pin.port() >= GPIO_WAKERS.len() {\n            panic!(\"Invalid GPIO port index {}\", self.pin.port());\n        }\n\n        let port_waker = GPIO_WAKERS[self.pin.port()];\n        if port_waker.is_none() {\n            panic!(\"Waker not present for GPIO port {}\", self.pin.port());\n        }\n\n        let waker = port_waker.unwrap().get_waker(self.pin.pin());\n        if waker.is_none() {\n            panic!(\n                \"Waker not present for GPIO pin {}, port {}\",\n                self.pin.pin(),\n                self.pin.port()\n            );\n        }\n        waker.unwrap().register(cx.waker());\n\n        // Double check that the pin interrut has been disabled by IRQ handler","sourceCodeStart":428,"sourceCodeEnd":464,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-imxrt/src/gpio.rs#L428-L464","documentation":"Panic in InputFuture::poll: the future's waker registry (GPIO_WAKERS) is sized for the number of GPIO ports the chip actually has. When polling, the pin's port index is checked against the table length; a port value at or beyond that length cannot have a registered waker, so interrupt-driven waiting is impossible and the code panics rather than silently never waking. The faulting input is a pin constructed with an out-of-range port number — a pin model/peripheral mismatch or an invalid port passed into GPIO configuration.","triggerScenarios":"Thrown at embassy-imxrt/src/gpio.rs:446 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use only pin definitions from the generated embassy-imxrt peripherals model for the actual chip variant","Check that the Cargo feature/board model matches the physical chip so GPIO_WAKERS covers all real ports","Fix code that fabricates pins with hand-written port numbers instead of using the peripherals struct","Validate port index at pin-construction time so invalid pins fail early, not during poll"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}