{"record":{"id":"1154d6321cfd4b1c","repo":"HMCL-dev/HMCL","slug":"theme-pack-manifest-field-is-blank-field","errorCode":null,"errorMessage":"Theme-pack manifest field is blank: ${field}","messagePattern":"Theme-pack manifest field is blank: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"HMCL/src/main/java/org/jackhuang/hmcl/theme/ThemePackManifest.java","lineNumber":239,"sourceCode":"            }\n            return new LocalizedText(localizedValues);\n        }\n        throw new JsonParseException(\"Theme-pack localized text must be a string or object: \" + field);\n    }\n\n    /// Returns a validated localized text value.\n    static LocalizedText requireLocalizedText(LocalizedText value, String field) {\n        Objects.requireNonNull(value);\n\n        JsonElement element = JsonUtils.GSON.toJsonTree(value, LocalizedText.class);\n        return parseLocalizedText(element, field);\n    }\n\n    /// Returns a non-blank string value.\n    private static String requireNonBlank(String value, String field) {\n        String trimmed = value.trim();\n        if (trimmed.isEmpty()) {\n            throw new IllegalArgumentException(\"Theme-pack manifest field is blank: \" + field);\n        }\n        return trimmed;\n    }\n\n    /// Returns a package ID matching the theme-pack ID format.\n    static String requirePackageId(String value) {\n        return requireId(value, \"id\", \"Theme-pack manifest ID must follow package ID format: \");\n    }\n\n    /// Returns a theme ID matching the theme-pack ID format.\n    static String requireThemeId(String value) {\n        return requireId(value, \"theme id\", \"Theme ID must follow package ID format: \");\n    }\n\n    /// Returns an ID matching the theme-pack ID format.\n    private static String requireId(String value, String field, String messagePrefix) {\n        String id = requireNonBlank(value, field);\n        if (!PACKAGE_ID_PATTERN.matcher(id).matches()) {","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCL/src/main/java/org/jackhuang/hmcl/theme/ThemePackManifest.java#L221-L257","documentation":"Thrown by ThemePackManifest.requireNonBlank when a required theme-pack manifest field (id, version, name text, etc.) is null-or-whitespace after trimming. The manifest parser rejects packs whose metadata fields are empty so downstream code never deals with blank identifiers or display names. It surfaces as IllegalArgumentException during manifest parsing.","triggerScenarios":"Parsing a theme-pack manifest whose \"id\", \"version\", or localized name string is \"\", \"   \", or whitespace-only; requireMemberString/parseLocalizedText feed raw JSON strings into requireNonBlank.","commonSituations":"Hand-edited theme_pack.json with an emptied field; a packaging script that substituted an unset variable into the manifest; copying a manifest template and forgetting to fill in the id.","solutions":["Open the pack's theme_pack.json and fill in the blank field named in the message (e.g. \"id\", \"version\").","Re-validate the manifest against CURRENT_SCHEMA after editing, then repack the zip.","If fields are generated by a script, ensure the source variables are non-empty before substitution."],"exampleFix":"// before\n\"version\": \"\"\n// after\n\"version\": \"1.0.0\"","handlingStrategy":"validation","validationCode":"boolean ok = manifest.optString(\"id\", \"\").isBlank() || manifest.optString(\"version\", \"\").isBlank() ? false : true;","typeGuard":null,"tryCatchPattern":"try { ThemePackManifest m = parse(json); } catch (IllegalArgumentException e) { showUserFriendlyMessage(e.getMessage()); }","preventionTips":["Never ship a manifest with empty metadata fields","Validate the manifest JSON before zipping the pack","Use a schema check tool on theme_pack.json in CI"],"tags":["theme-pack","manifest","validation"],"backgroundTag":"empty-required-field","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"}