{"record":{"id":"791303105d03a929","repo":"beemdevelopment/Aegis","slug":"bad-uuid-format-s","errorCode":null,"errorMessage":"Bad UUID format: %s","messagePattern":"Bad UUID format: (.+?)","errorType":"exception","errorClass":"JSONException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/com/beemdevelopment/aegis/icons/IconPack.java","lineNumber":113,"sourceCode":"            return false;\n        }\n\n        IconPack pack = (IconPack) o;\n        return super.equals(pack) || (getUUID().equals(pack.getUUID()) && getVersion() == pack.getVersion());\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hashCode(_uuid, _version);\n    }\n\n    public static IconPack fromJson(JSONObject obj) throws JSONException {\n        UUID uuid;\n        String uuidString = obj.getString(\"uuid\");\n        try {\n            uuid = UUID.fromString(uuidString);\n        } catch (IllegalArgumentException e) {\n            throw new JSONException(String.format(\"Bad UUID format: %s\", uuidString));\n        }\n        String name = obj.getString(\"name\");\n        int version = obj.getInt(\"version\");\n        JSONArray array = obj.getJSONArray(\"icons\");\n\n        List<Icon> icons = new ArrayList<>();\n        for (int i = 0; i < array.length(); i++) {\n            Icon icon = Icon.fromJson(array.getJSONObject(i));\n            icons.add(icon);\n        }\n\n        return new IconPack(uuid, name, version, icons);\n    }\n\n    public static IconPack fromBytes(byte[] data) throws JSONException {\n        JSONObject obj = new JSONObject(new String(data, StandardCharsets.UTF_8));\n        return IconPack.fromJson(obj);\n    }","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/beemdevelopment/Aegis/blob/d6f4e5925a97e4e91593f1542085eae03432a759/app/src/main/java/com/beemdevelopment/aegis/icons/IconPack.java#L95-L131","documentation":"IconPack.fromJson parses the icon pack definition (pack.json) and requires the \"uuid\" field to be a parseable java.util.UUID. If UUID.fromString throws IllegalArgumentException, the JSON is structurally fine but the identifier is malformed, so it is rethrown as a JSONException naming the bad value. This guards against importing icon packs with corrupted or hand-edited metadata.","triggerScenarios":"Importing an icon pack whose pack.json has a \"uuid\" string that is not in canonical 8-4-4-4-12 hex format (missing dashes, wrong length, non-hex characters, or empty).","commonSituations":"Hand-editing pack.json and typos in the UUID; a pack generator emitting UUIDs in a nonstandard format (e.g. with braces or URN prefix); truncated/corrupted pack.json after a bad ZIP transfer.","solutions":["Open pack.json and fix the \"uuid\" field to canonical UUID format (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)","Regenerate the UUID with UUID.randomUUID().toString() and repackage the ZIP","Re-download the icon pack from the original source","Validate the JSON before import with a quick UUID.fromString check"],"exampleFix":"// before\n\"uuid\": \"{31d7a1c8-8b3e-4c2f-9a11-b2c4d5e6f708}\"\n// after\n\"uuid\": \"31d7a1c8-8b3e-4c2f-9a11-b2c4d5e6f708\"","handlingStrategy":"validation","validationCode":"String uuidString = obj.optString(\"uuid\", \"\");\ntry { java.util.UUID.fromString(uuidString); } catch (IllegalArgumentException e) { /* reject pack before import */ }","typeGuard":"boolean isValidUuid(String s) {\n    return s != null && s.matches(\"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$\");\n}","tryCatchPattern":"try {\n    IconPack pack = IconPack.fromJson(obj);\n} catch (JSONException e) {\n    Log.w(TAG, \"Invalid icon pack definition: \" + e.getMessage());\n}","preventionTips":["Always emit UUIDs via UUID.randomUUID().toString() when authoring packs","Lint pack.json for canonical UUID format before zipping","Never hand-edit the uuid field; generate it","Validate the definition JSON with a schema in your pack build script"],"tags":["uuid","json","validation","icon-pack"],"backgroundTag":"invalid-identifier-format","analyzedSha":"d6f4e5925a97e4e91593f1542085eae03432a759","analyzedAt":"2026-09-08T00:46:31.111Z","contentChangedAt":"2026-09-08T00:46:31.111Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}