{"record":{"id":"7703672b10f16efc","repo":"HMCL-dev/HMCL","slug":"unsupported-protected-payload","errorCode":null,"errorMessage":"Unsupported protected payload: ","messagePattern":"Unsupported protected payload: ","errorType":"validation","errorClass":"JsonParseException","httpStatus":null,"severity":"error","filePath":"HMCL/src/main/java/org/jackhuang/hmcl/setting/ProtectedPayload.java","lineNumber":347,"sourceCode":"        }\n\n        /// Reads the protection mode from an envelope.\n        ///\n        /// @param envelope the envelope object to inspect\n        /// @return the protection mode declared by the envelope\n        /// @throws JsonParseException if the declared protection mode is unsupported\n        static ProtectionMode fromEnvelope(JsonObject envelope) {\n            String protection = JsonUtils.getString(envelope, PROPERTY_PROTECTION);\n            if (protection == null) {\n                throw new JsonParseException(\"Missing protected payload member: protection\");\n            }\n\n            for (ProtectionMode mode : values()) {\n                if (mode.id.equals(protection)) {\n                    return mode;\n                }\n            }\n            throw new JsonParseException(\"Unsupported protected payload: \" + protection);\n        }\n    }\n\n    /// Reads and reveals a protected JSON payload from an envelope object.\n    ///\n    /// @param envelope the envelope object to read from\n    /// @param payloadType the expected JSON element type\n    /// @return the revealed JSON payload\n    /// @param <T> the expected JSON element type\n    /// @throws JsonParseException if the envelope is malformed or cannot be revealed\n    static <T extends JsonElement> T read(JsonObject envelope, Class<T> payloadType) throws JsonParseException {\n        return ProtectionMode.fromEnvelope(envelope).read(envelope, payloadType);\n    }\n\n}\n","sourceCodeStart":329,"sourceCodeEnd":363,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCL/src/main/java/org/jackhuang/hmcl/setting/ProtectedPayload.java#L329-L363","documentation":"After reading the 'protection' member, fromEnvelope iterates all ProtectionMode values and returns the one whose id matches. If no enum constant matches the declared id, it throws JsonParseException, meaning the envelope declares a protection mode this HMCL build does not support.","triggerScenarios":"Envelopes whose 'protection' member contains an unknown id — e.g. produced by a newer HMCL version, corrupted by manual editing, or containing a typo.","commonSituations":"Downgrading HMCL to an older release that predates the protection mode; hand-editing the protection id; file corruption.","solutions":["Use an HMCL version that supports the declared protection mode (upgrade HMCL)","Correct the 'protection' id to a value supported by this build (inspect ProtectionMode.values() ids)","Regenerate the envelope with the current library so it writes a supported mode","Catch JsonParseException and treat the payload as unrecoverable, prompting re-entry of the secret"],"exampleFix":"// before\n{\"protection\":\"quantum-sealed\",\"payload\":\"...\"}\n// after\n{\"protection\":\"none\",\"payload\":\"...\"}","handlingStrategy":"try-catch","validationCode":"String p = JsonUtils.getString(envelope, PROPERTY_PROTECTION); if (p != null && Arrays.stream(ProtectionMode.values()).noneMatch(m -> m.id.equals(p))) { throw new IllegalArgumentException(\"unsupported protection: \" + p); }","typeGuard":null,"tryCatchPattern":"try { mode = ProtectionMode.fromEnvelope(envelope); } catch (JsonParseException e) { LOG.warning(\"Unsupported protection mode: \" + e.getMessage(), e); }","preventionTips":["Upgrade HMCL when encountering unknown protection ids","Never downgrade HMCL beneath the versions that wrote your config files","Log the offending id to identify the producer version"],"tags":["json","config","enum"],"backgroundTag":"unsupported-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"}