#6289·gleam

Index out of bounds when updating record with incorrect arity in constant

Author: DanielVenableCreated Sep 9, 2026Updated Sep 10, 2026
Labelshelp wanted

When working on https://github.com/gleam-lang/gleam/issues/5916 I encountered this bug. The following code causes the compiler to panic from index out of bounds:

gleam
type Wibble {
  Wibble(wibble: Int, wobble: Int)
}

const a = Wibble(wibble: 0)
const b = Wibble(..a, wobble: 8)
Panic: compiler-core/src/type_/expression.rs:4160
        Index out of bounds
Gleam version: 1.18.0
Operating system: linux