gleam-lang/gleam · error

no variable size

Error message

no variable size

What it means

Error "no variable size" thrown in gleam-lang/gleam.

Source

Thrown at compiler-core/src/javascript/decision.rs:1777

            _ => (),
        }

        // Otherwise we'll take a regular slice out of the bit array, depending
        // on the type of the segment.
        let (start, end) =
            if let (ReadSize::ConstantBits(size), Some(from_bits)) = (size, from_bits) {
                // If both the start and and are known at compile time we can use
                // those directly in the slice call and perform no addition at
                // runtime.
                let start = from_bits.clone().to_doc(arena);
                let end = (from_bits + size).to_doc(arena);
                (start, end)
            } else {
                // Otherwise we'll have to sum the variable part and the constant
                // one to tell how long the slice should be.
                let size = self
                    .read_size_to_doc(arena, size)
                    .expect("no variable size");
                let start = self.offset_to_doc(arena, from, false);
                let end = if from.is_zero() {
                    size
                } else {
                    docvec![arena, start, SPACE_PLUS_SPACE_DOCUMENT, size]
                };
                (start, end)
            };

        match type_ {
            ReadType::Int => {
                self.bit_array_slice_to_int(arena, bit_array, start, end, endianness, *signed)
            }
            ReadType::Float => {
                self.bit_array_slice_to_float(arena, bit_array, start, end, endianness)
            }
            ReadType::BitArray => self.bit_array_slice_with_end(arena, bit_array, from, end),
            ReadType::String | ReadType::UtfCodepoint => {

View on GitHub (pinned to 7e623aa83d)

When it happens

Trigger: Thrown at compiler-core/src/javascript/decision.rs:1777 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of gleam-lang/gleam@7e623aa83d (2026-08-17). Data as JSON: /api/errors/c22ce6aec6a7c103. Report an issue: GitHub.