{"record":{"id":"7729f68c4fcdc556","repo":"HMCL-dev/HMCL","slug":"file-modfile-is-not-a-forge-1-13-or-neof","errorCode":null,"errorMessage":"\"File \" + modFile + \" is not a Forge 1.13+ or NeoForge mod.\"","messagePattern":"\"File \" \\+ modFile \\+ \" is not a Forge 1\\.13\\+ or NeoForge mod\\.\"","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/addon/meta/ForgeNewModMetadata.java","lineNumber":210,"sourceCode":"\n        if (modLoaderType == ModLoaderType.NEO_FORGE) {\n            try {\n                return fromFile0(\"META-INF/neoforge.mods.toml\", modLoaderType, modManager, modFile, tree);\n            } catch (Exception ignored) {\n            }\n        }\n\n        try {\n            return fromFile0(\"META-INF/mods.toml\", modLoaderType, modManager, modFile, tree);\n        } catch (Exception ignored) {\n        }\n\n        try {\n            return fromEmbeddedMod(modManager, modFile, tree, modLoaderType);\n        } catch (Exception ignored) {\n        }\n\n        throw new IOException(\"File \" + modFile + \" is not a Forge 1.13+ or NeoForge mod.\");\n    }\n\n    private static LocalModFile fromFile0(\n            String tomlPath,\n            ModLoaderType modLoaderType,\n            ModManager modManager,\n            Path modFile,\n            ZipFileTree tree) throws IOException, JsonParseException {\n        ZipArchiveEntry modToml = tree.getEntry(tomlPath);\n        if (modToml == null)\n            throw new IOException(\"File \" + modFile + \" is not a Forge 1.13+ or NeoForge mod.\");\n        TomlParseResult tomlParseResult = Toml.parse(tree.readTextEntry(modToml));\n        if (tomlParseResult.hasErrors()) {\n            var ioException = new IOException(\"Mod \" + modFile + \" `%s` is malformed..\".formatted(modToml.getName()));\n            tomlParseResult.errors().forEach(ioException::addSuppressed);\n            throw ioException;\n        }\n        ForgeNewModMetadata metadata = JsonUtils.GSON.fromJson(tomlParseResult.toJson(), ForgeNewModMetadata.class);","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/addon/meta/ForgeNewModMetadata.java#L192-L228","documentation":"Thrown by ForgeNewModMetadata.fromFile as the last-resort failure after fromEmbeddedMod (which handles Forge 1.13+/NeoForge jars with META-INF/MANIFEST.MF or jar-in-jar data) also raised an exception. It means the jar neither exposes the expected mods.toml/neoforge.mods.toml nor embeds the manifest data HMCL needs, so it cannot be recognized as a Forge 1.13+/NeoForge mod.","triggerScenarios":"Calling ForgeNewModMetadata.fromFile (directly or via fromForgeFile/fromNeoForgeFile/fromEmbeddedMod) on a jar where the toml entry is absent AND the embedded-mod path failed (e.g. no MANIFEST.MF, no jarjar metadata, or embedded entries unreadable).","commonSituations":"Scanning a legacy Forge 1.12 mod (uses mcmod.info) through the modern Forge parser; a broken or truncated jar; a Fabric or plain library jar misidentified as Forge.","solutions":["Check the jar for META-INF/mods.toml or META-INF/neoforge.mods.toml (unzip -l mod.jar); if absent, it is not a 1.13+ Forge/NeoForge mod.","For 1.12.2-and-older mods, use ForgeOldModMetadata.fromFile instead.","Re-download the mod; a truncated or corrupt jar fails both parse paths.","Confirm the mod is actually a Forge/NeoForge build, not a Fabric build, before calling this parser."],"exampleFix":"// before\nLocalModFile mod = ForgeNewModMetadata.fromFile(modManager, modFile, tree, ModLoaderType.FORGE); // throws on 1.12 mods\n// after\nif (tree.getEntry(\"META-INF/mods.toml\") == null && tree.getEntry(\"META-INF/MANIFEST.MF\") == null) {\n    throw new IllegalArgumentException(modFile + \" is not a Forge 1.13+ mod; try ForgeOldModMetadata\");\n}\nLocalModFile mod = ForgeNewModMetadata.fromFile(modManager, modFile, tree, ModLoaderType.FORGE);","handlingStrategy":"try-catch","validationCode":"boolean looksLikeModernForge(ZipFileTree tree) {\n    return tree.getEntry(\"META-INF/mods.toml\") != null\n        || tree.getEntry(\"META-INF/neoforge.mods.toml\") != null\n        || tree.getEntry(\"META-INF/MANIFEST.MF\") != null;\n}","typeGuard":null,"tryCatchPattern":"try {\n    LocalModFile mod = ForgeNewModMetadata.fromFile(modManager, modFile, tree, loaderType);\n} catch (IOException | JsonParseException e) {\n    // fall back to legacy parser or skip the jar\n}","preventionTips":["Detect mod loader before choosing the parser","Use ForgeOldModMetadata for 1.12-and-older jars","Treat failures of both paths as 'not a modern Forge mod' rather than retrying"],"tags":["minecraft","forge","neoforge","mod-loader"],"backgroundTag":"resource-not-found","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"}