{"record":{"id":"087bdbe7c2bc5c54","repo":"HMCL-dev/HMCL","slug":"unsupported-theme-background-type","errorCode":null,"errorMessage":"Unsupported theme background type: ","messagePattern":"Unsupported theme background type: ","errorType":"validation","errorClass":"JsonParseException","httpStatus":null,"severity":"error","filePath":"HMCL/src/main/java/org/jackhuang/hmcl/theme/ThemeBackground.java","lineNumber":109,"sourceCode":"            if (id != null) {\n                return new Builtin(id);\n            }\n            if (path != null) {\n                return new Image(path);\n            }\n            if (paint != null) {\n                return new Paint(paint);\n            }\n            return null;\n        }\n\n        return switch (type.trim().replace('-', '_').toUpperCase(Locale.ROOT)) {\n            case \"DEFAULT\" -> new Default();\n            case \"BUILTIN\" -> new Builtin(id);\n            case \"IMAGE\" -> new Image(path);\n            case \"PAINT\" -> new Paint(paint);\n            case \"THEME_COLOR\" -> new ThemeColor();\n            default -> throw new JsonParseException(\"Unsupported theme background type: \" + type);\n        };\n    }\n\n    /// Reads an optional string field.\n    private static @Nullable String readString(JsonObject object, String field) {\n        JsonElement element = object.get(field);\n        if (element == null) {\n            return null;\n        }\n        if (!(element instanceof JsonPrimitive primitive) || !primitive.isString()) {\n            throw new JsonParseException(\"Theme background field must be a string: \" + field);\n        }\n        return primitive.getAsString();\n    }\n\n    /// Returns a required non-blank string value.\n    private static String requireNonBlank(@Nullable String value, String field) {\n        if (value == null) {","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCL/src/main/java/org/jackhuang/hmcl/theme/ThemeBackground.java#L91-L127","documentation":"ThemeBackground.fromJson throws this when the \"type\" field contains a value that does not match any supported enum literal after normalization: trim, replace '-' with '_', uppercase. Supported values are DEFAULT, BUILTIN, IMAGE, PAINT, and THEME_COLOR. The exception is a Gson JsonParseException whose message appends the offending type string.","triggerScenarios":"fromJson on a JsonObject whose \"type\" is not one of default/builtin/image/paint/theme_color (case-insensitive, hyphen or underscore), e.g. {\"type\":\"video\"} or {\"type\":\"imagefile\"}.","commonSituations":"Typo in a theme-pack manifest (\"imag\" instead of \"image\"), a type added by a newer/older HMCL version than the parser, or authors copying type names from other launchers' theme formats.","solutions":["Change \"type\" to one of the supported values: default, builtin, image, paint, theme_color","Check for spelling/whitespace issues; keep the value lowercase for safety","Verify the HMCL version supports the desired type; if the type is from a newer release, upgrade HMCL or use a supported alternative"],"exampleFix":"// before\n{\"type\": \"gradient\"}\n// after\n{\"type\": \"paint\", \"paint\": \"linear-gradient(to bottom right, #123, #456)\"}","handlingStrategy":"validation","validationCode":"String t = obj.has(\"type\") ? obj.get(\"type\").getAsString() : null;\nif (t != null && Set.of(\"default\",\"builtin\",\"image\",\"paint\",\"theme_color\").stream().noneMatch(v -> v.equalsIgnoreCase(t.replace('-', '_')))) throw new IllegalArgumentException(\"Unsupported type: \" + t);","typeGuard":null,"tryCatchPattern":"try { ThemeBackground.fromJson(obj); } catch (JsonParseException e) { LOG.warning(\"Unknown background type, using default: \" + e.getMessage()); return new ThemeBackground.Default(); }","preventionTips":["Use only documented type literals: default, builtin, image, paint, theme_color","Write types lowercase; '-' and '_' are interchangeable","Cross-check type names against the HMCL version you ship for"],"tags":["json","enum","theme-config"],"backgroundTag":"invalid-enum-value","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"}