{"record":{"id":"83cd6c3b431e3496","repo":"HMCL-dev/HMCL","slug":"theme-is-missing-the-id","errorCode":null,"errorMessage":"Theme is missing the id","messagePattern":"Theme is missing the id","errorType":"validation","errorClass":"JsonParseException","httpStatus":null,"severity":"error","filePath":"HMCL/src/main/java/org/jackhuang/hmcl/theme/Theme.java","lineNumber":105,"sourceCode":"    /// @return the parsed theme\n    /// @throws JsonParseException if required identity fields are missing or malformed\n    static Theme fromJson(JsonObject object, boolean requireIdentity) throws JsonParseException {\n        Objects.requireNonNull(object);\n\n        @Nullable String id = JsonUtils.getString(object, \"id\");\n        if (id != null) {\n            try {\n                id = ThemePackManifest.requireThemeId(id);\n            } catch (IllegalArgumentException e) {\n                if (requireIdentity) {\n                    throw new JsonParseException(e);\n                }\n                LOG.warning(\"Ignored invalid theme id: \" + id, e);\n                id = null;\n            }\n        }\n        if (id == null && requireIdentity) {\n            throw new JsonParseException(\"Theme is missing the id\");\n        }\n        @Nullable LocalizedText name;\n        try {\n            name = LocalizedText.fromJson(object.get(\"name\"));\n            if (name != null && name.mayBeEmpty()) {\n                throw new JsonParseException(\"Theme name is empty: \" + name);\n            }\n        } catch (JsonParseException | IllegalArgumentException e) {\n            if (requireIdentity) {\n                throw e;\n            }\n            LOG.warning(\"Ignored invalid theme name\", e);\n            name = null;\n        }\n        if (name == null && requireIdentity) {\n            throw new JsonParseException(\"Theme is missing required localized text field: \" + \"name\");\n        }\n","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCL/src/main/java/org/jackhuang/hmcl/theme/Theme.java#L87-L123","documentation":"A sentinel error raised in Theme.fromJson() when the theme must declare an explicit identity (requireIdentity is true) but its JSON object has no 'id' field. It fires for packs where each theme must be addressable by ID; anonymous themes are only tolerated in single-theme packs where requireIdentity is false.","triggerScenarios":"Thrown at HMCL/src/main/java/org/jackhuang/hmcl/theme/Theme.java:105 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add an 'id' field in package ID format to the theme's JSON entry.","If the theme pack contains only one theme, drop the identity requirement rather than fabricating an ID.","Replace the malformed theme pack with a valid one."],"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-23T08:17:48.524Z"}