{"record":{"id":"b0ef0401a5a87927","repo":"HMCL-dev/HMCL","slug":"unrecognized-optifine-installer","errorCode":null,"errorMessage":"Unrecognized OptiFine installer","messagePattern":"Unrecognized OptiFine installer","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/download/optifine/OptiFineInstallTask.java","lineNumber":280,"sourceCode":"    public static Task<GameInstancePatch> install(\n            DefaultDependencyManager dependencyManager,\n            GameInstanceManifest manifest,\n            String gameVersion,\n            Path installer) throws IOException, VersionMismatchException {\n        try (FileSystem fs = CompressingUtils.createReadOnlyZipFileSystem(installer)) {\n            Path configClass = fs.getPath(\"Config.class\");\n            if (!Files.exists(configClass)) configClass = fs.getPath(\"net/optifine/Config.class\");\n            if (!Files.exists(configClass)) configClass = fs.getPath(\"notch/net/optifine/Config.class\");\n            if (!Files.exists(configClass)) throw new IOException(\"Unrecognized installer\");\n            ConstantPool pool = ConstantPoolScanner.parse(Files.readAllBytes(configClass), ConstantType.UTF8);\n            List<String> constants = new ArrayList<>();\n            pool.list(Utf8Constant.class).forEach(utf8 -> constants.add(utf8.get()));\n            String mcVersion = getOrDefault(constants, constants.indexOf(\"MC_VERSION\") + 1, null);\n            String ofEdition = getOrDefault(constants, constants.indexOf(\"OF_EDITION\") + 1, null);\n            String ofRelease = getOrDefault(constants, constants.indexOf(\"OF_RELEASE\") + 1, null);\n\n            if (mcVersion == null || ofEdition == null || ofRelease == null)\n                throw new IOException(\"Unrecognized OptiFine installer\");\n\n            if (!mcVersion.equals(gameVersion))\n                throw new VersionMismatchException(mcVersion, gameVersion);\n\n            OptiFineRemoteVersion remoteVersion = new OptiFineRemoteVersion(\n                    mcVersion,\n                    ofEdition + \"_\" + ofRelease,\n                    Collections.singletonList(\"\"),\n                    false);\n            return new GameDownloadTask(dependencyManager, manifest)\n                    .thenComposeAsync(minecraftJar -> new OptiFineInstallTask(\n                            dependencyManager,\n                            manifest,\n                            remoteVersion,\n                            minecraftJar,\n                            installer));\n        }\n    }","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/download/optifine/OptiFineInstallTask.java#L262-L298","documentation":"Thrown when the Config.class found in the OptiFine installer lacks required string constants MC_VERSION, OF_EDITION, or OF_RELEASE. HMCL cannot determine which game version the installer targets, so it refuses to proceed.","triggerScenarios":"Parsing the constant pool of Config.class via ConstantPoolScanner and finding any of mcVersion/ofEdition/ofRelease null — i.e. the jar looks like an OptiFine installer structurally but its metadata constants are missing or the class format is too new to parse.","commonSituations":"Tampered/refactored OptiFine builds, obfuscated or repackaged jars from mirrors, or future OptiFine versions that change constant names.","solutions":["Download the installer from the official OptiFine site to get an unmodified build.","Verify the jar's Config.class contains MC_VERSION/OF_EDITION/OF_RELEASE constants (javap -constants).","Use an older, known-good OptiFine build for the target game version."],"exampleFix":"// before\nif (mcVersion == null || ofEdition == null || ofRelease == null)\n    throw new IOException(\"Unrecognized OptiFine installer\");\n// after\nif (mcVersion == null || ofEdition == null || ofRelease == null)\n    throw new IOException(\"Unrecognized OptiFine installer: missing \"\n        + (mcVersion == null ? \"MC_VERSION \" : \"\") + (ofEdition == null ? \"OF_EDITION \" : \"\")\n        + (ofRelease == null ? \"OF_RELEASE\" : \"\") + \" in Config.class\");","handlingStrategy":"validation","validationCode":"String constants = new String(Files.readAllBytes(configClass), StandardCharsets.ISO_8859_1);\nif (!constants.contains(\"MC_VERSION\") || !constants.contains(\"OF_EDITION\"))\n    throw new IllegalArgumentException(\"Not a standard OptiFine installer\");","typeGuard":null,"tryCatchPattern":"try {\n    await(task);\n} catch (IOException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"Unrecognized OptiFine installer\")) {\n        // re-download unmodified installer from official site\n    }\n}","preventionTips":["Use unmodified official OptiFine builds","Inspect Config.class constants (javap -constants) when in doubt","Avoid repackaged jars from third-party mirrors"],"tags":["optifine","installer","metadata-missing","constant-pool"],"backgroundTag":"unexpected-response-shape","analyzedSha":"24702dc5a0214034f4c27166d5fd30cad08cec19","analyzedAt":"2026-09-10T12:36:46.680Z","contentChangedAt":"2026-09-10T12:36:46.680Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}