{"record":{"id":"9e4b8433c311a84f","repo":"HMCL-dev/HMCL","slug":"launcher-background-opacity-must-be-between-0-and","errorCode":null,"errorMessage":"Launcher background opacity must be between 0 and 1: ","messagePattern":"Launcher background opacity must be between 0 and 1: ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"HMCL/src/main/java/org/jackhuang/hmcl/theme/LauncherBackground.java","lineNumber":35,"sourceCode":" */\npackage org.jackhuang.hmcl.theme;\n\nimport javafx.scene.layout.Background;\nimport org.jetbrains.annotations.NotNullByDefault;\n\nimport java.util.Objects;\n\n/// A launcher background and the opacity applied by its rendering node.\n///\n/// @param background the JavaFX background rendered by the launcher\n/// @param opacity     the node opacity in the range `[0, 1]`\n@NotNullByDefault\npublic record LauncherBackground(Background background, double opacity) {\n    /// Creates a launcher background value.\n    public LauncherBackground {\n        Objects.requireNonNull(background);\n        if (!Double.isFinite(opacity) || opacity < 0.0 || opacity > 1.0) {\n            throw new IllegalArgumentException(\"Launcher background opacity must be between 0 and 1: \" + opacity);\n        }\n    }\n\n}\n","sourceCodeStart":17,"sourceCodeEnd":40,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCL/src/main/java/org/jackhuang/hmcl/theme/LauncherBackground.java#L17-L40","documentation":"Thrown by the compact constructor of the LauncherBackground record when the supplied opacity is outside the [0, 1] range (or not a finite double). It is an invariant guard for the record: the rendering node applies opacity directly, so out-of-range values would produce undefined JavaFX behavior. The input at fault is an opacity value parsed from a launcher theme/skin configuration.","triggerScenarios":"Thrown at HMCL/src/main/java/org/jackhuang/hmcl/theme/LauncherBackground.java:35 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the theme file so the opacity setting is a number between 0 and 1 inclusive.","Clamp the parsed value before constructing LauncherBackground, e.g. Math.max(0, Math.min(1, opacity)).","If the opacity is missing or unparsable, fall back to a default value such as 1.0."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"24702dc5a0214034f4c27166d5fd30cad08cec19","analyzedAt":"2026-09-10T12:36:46.680Z","contentChangedAt":"2026-09-10T12:36:46.680Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}