{"record":{"id":"c69d78402d33b4a4","repo":"gleam-lang/gleam","slug":"errortype-conflictingsizeoptions","errorCode":null,"errorMessage":"ErrorType::ConflictingSizeOptions","messagePattern":"ErrorType::ConflictingSizeOptions","errorType":"validation","errorClass":"ErrorType","httpStatus":null,"severity":"error","filePath":"compiler-core/src/bit_array.rs","lineNumber":184,"sourceCode":"                );\n            }\n\n            Big { .. } | Little { .. } | Native { .. } => {\n                if let Some(previous) = categories.endian {\n                    return err(\n                        ErrorType::ConflictingEndiannessOptions {\n                            existing_endianness: previous.label(),\n                        },\n                        option.location(),\n                    );\n                } else {\n                    categories.endian = Some(option);\n                }\n            }\n\n            Size { .. } => {\n                if categories.size.is_some() {\n                    return err(ErrorType::ConflictingSizeOptions, option.location());\n                } else {\n                    categories.size = Some(option);\n                }\n            }\n\n            Unit { .. } => {\n                if categories.unit.is_some() {\n                    return err(ErrorType::ConflictingUnitOptions, option.location());\n                } else {\n                    categories.unit = Some(option);\n                }\n            }\n        }\n    }\n\n    // Some options are not allowed in value mode\n    if mode == TypeOptionsMode::Expression {\n        match categories {","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/gleam-lang/gleam/blob/15b07c783065c92bb016b1b74ed0995a5259850f/compiler-core/src/bit_array.rs#L166-L202","documentation":"ErrorType::ConflictingSizeOptions is raised when a bit array segment declares the size option more than once (e.g. two 'size:n' options on one segment). Each segment may have at most one size specification.","triggerScenarios":"Writing <<x:int-size(8)-size(16)>> or similar duplicated size options; also combining size with a variable-sized option in ways that set categories.size twice.","commonSituations":"Merging edits that both added a size; copy-paste from another segment that already had a size; adjusting a size and leaving the old option in place.","solutions":["Keep only one size option per segment","If you meant a byte-vs-bit unit distinction, use the unit option alongside a single size","Recompute the intended size and replace, don't append, the existing size option"],"exampleFix":"// before\n<<id:int-size(4)-size(8)>>\n// after\n<<id:int-size(8)>>","handlingStrategy":"validation","validationCode":"// At most one `size:` option per segment\nfn size_option_count(spec: String) -> Int {\n  string.split(spec, \"size:\") |> list.length |> int.subtract(1)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Edit sizes in place; never add a second size option","Remember the total segment size is size * unit — adjust one of them, not both by stacking","Search segments for 'size' before merging branches that both touch sizing"],"tags":["gleam","bit-array","conflicting-options"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"15b07c783065c92bb016b1b74ed0995a5259850f","analyzedAt":"2026-09-14T11:14:59.388Z","contentChangedAt":"2026-09-14T11:14:59.388Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}