{"record":{"id":"94389fab5c18266a","repo":"gleam-lang/gleam","slug":"this-is-an-extra-type-specifier","errorCode":null,"errorMessage":"This is an extra type specifier","messagePattern":"This is an extra type specifier","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"compiler-core/src/bit_array.rs","lineNumber":135,"sourceCode":"                        target,\n                        option: UnsupportedOption::UtfCodepointPattern,\n                    },\n                    option.location(),\n                );\n            }\n\n            Bytes { .. }\n            | Int { .. }\n            | Float { .. }\n            | Bits { .. }\n            | Utf8 { .. }\n            | Utf16 { .. }\n            | Utf32 { .. }\n            | Utf8Codepoint { .. }\n            | Utf16Codepoint { .. }\n            | Utf32Codepoint { .. } => {\n                if let Some(previous) = categories.type_ {\n                    return err(\n                        ErrorType::ConflictingTypeOptions {\n                            existing_type: previous.label(),\n                        },\n                        option.location(),\n                    );\n                } else {\n                    categories.type_ = Some(option);\n                }\n            }\n\n            Signed { .. } | Unsigned { .. } => {\n                if let Some(previous) = categories.signed {\n                    return err(\n                        ErrorType::ConflictingSignednessOptions {\n                            existing_signed: previous.label(),\n                        },\n                        option.location(),\n                    );","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/gleam-lang/gleam/blob/3e3c5ddc08f0e23b3f7e5331506920b884007b5f/compiler-core/src/bit_array.rs#L117-L153","documentation":"Gleam compile error (BitArraySegmentError::ConflictingTypeOptions): a single bit array segment was given more than one type specifier. The compiler treats bytes, int, float, bits, utf8, utf16, utf32, utf8_codepoint, utf16_codepoint, and utf32_codepoint as type options; once categories.type_ is set by the first one, any later type option in the same segment triggers this error. The diagnostic labels the second occurrence 'This is an extra type specifier' and adds a hint naming the type already in effect (e.g. 'This segment already has the type int.').","triggerScenarios":"Writing a segment with two type options such as '<<1:int-bytes>>' or '<<\"x\":utf8-utf16>>' — typically when '-' was intended as a segment separator rather than an option separator inside one segment. The snapshot test 'let x = <<1:int-bytes>>' shows the canonical case.","commonSituations":"Newcomers writing bit arrays for the first time combining int/bytes or utf variants in one segment; copying binary-syntax from Erlang where meanings differ; quick edits that leave a stale option behind.","solutions":["Keep exactly one type option per segment: delete the duplicate specifier flagged by 'This is an extra type specifier'","If two typed values were intended, split into two segments separated by a comma: <<1:int, x:bytes>>","Read the hint line naming the existing type and the linked tour.gleam.run bit-array guide"],"exampleFix":"// before\nlet x = <<1:int-bytes>>\n\n// after (one type per segment; use a comma for multiple segments)\nlet x = <<1:int, rest:bytes>>","handlingStrategy":"validation","validationCode":"# surface duplicate type options immediately after editing bit arrays\ngleam check","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Write at most one type option (int, bytes, float, bits, utf8/16/32, *_codepoint) per bit array segment","Use commas to separate segments; hyphens only join options within one segment","Read the hint under the error: it names the type already applied to the segment"],"tags":["bit-array","compile-error","segments","gleam"],"backgroundTag":"bit-array-conflicting-options","analyzedSha":"3e3c5ddc08f0e23b3f7e5331506920b884007b5f","analyzedAt":"2026-08-20T06:21:11.390Z","contentChangedAt":"2026-08-20T06:21:11.390Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}