{"record":{"id":"ecf188fad07c6ba2","repo":"HMCL-dev/HMCL","slug":"missing-embedded-mods","errorCode":null,"errorMessage":"Missing embedded mods","messagePattern":"Missing embedded mods","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/addon/meta/ForgeNewModMetadata.java","lineNumber":295,"sourceCode":"                if (metadata == null)\n                    throw new IOException(\"Invalid metadata file: \" + jarInJarMetadata);\n\n                metadata.validate();\n\n                embeddedModFiles = new ArrayList<>();\n                for (EmbeddedJarMetadata jar : metadata.jars) {\n                    ZipArchiveEntry path = tree.getEntry(jar.path);\n                    if (path != null) {\n                        embeddedModFiles.add(path);\n                    } else {\n                        LOG.warning(\"Missing embedded-dependencies-mod: \" + jar.path);\n                    }\n                }\n            }\n        }\n\n        if (embeddedModFiles.isEmpty()) {\n            throw new IOException(\"Missing embedded mods\");\n        }\n\n        Path tempFile = Files.createTempFile(\"hmcl-\", \".zip\");\n        try {\n            for (ZipArchiveEntry embeddedModFile : embeddedModFiles) {\n                tree.extractTo(embeddedModFile, tempFile);\n                try (ZipFileTree embeddedTree = CompressingUtils.openZipTree(tempFile)) {\n                    return fromFile(modManager, modFile, embeddedTree, modLoaderType);\n                } catch (Exception ignored) {\n                }\n            }\n        } finally {\n            Files.deleteIfExists(tempFile);\n        }\n\n        throw new IOException();\n    }\n","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/addon/meta/ForgeNewModMetadata.java#L277-L313","documentation":"Thrown by ForgeNewModMetadata.fromEmbeddedMod when, after checking both the Embedded-Dependencies-Mod attribute and jarjar/metadata.json, the embeddedModFiles list is empty. This code path is only reached when a jar looks like an embedded-dependency carrier but declares no nested jars, so HMCL has no mod data to extract.","triggerScenarios":"fromFile -> fromEmbeddedMod on a jar that has neither an Embedded-Dependencies-Mod manifest attribute nor a jarjar/metadata.json with a non-empty jars array (or the metadata.json was absent), leaving embeddedModFiles empty.","commonSituations":"A repackaged Forge jar whose jarjar metadata was stripped; a jar with an empty jars array in metadata.json; a mod carrier jar missing both manifest attribute and metadata.json.","solutions":["Verify the jar contains META-INF/jarjar/metadata.json with a non-empty jars array.","Re-download the mod from its official source; official jar-in-jar builds always declare their nested jars.","If you build the mod, ensure embedded dependencies are declared via jarJar configuration so metadata.json is generated.","If the jar intentionally has no embedded mods, it should not take the embedded path — check its mods.toml is intact."],"exampleFix":"// before (metadata.json)\n{ \"jars\": [] }\n// after\n{ \"jars\": [ { \"identifier\": { \"group\": \"com.example\", \"artifact\": \"dep\" }, \"version\": \"1.0.0\", \"path\": \"META-INF/jarjar/dep-1.0.0.jar\" } ] }","handlingStrategy":"validation","validationCode":"ZipArchiveEntry jarjar = tree.getEntry(\"META-INF/jarjar/metadata.json\");\nif (jarjar == null || tree.getChildren(\"META-INF/jarjar\").isEmpty()) {\n    // no embedded jars declared; this jar will fail the embedded path\n    LOG.warning(\"No embedded mods declared in \" + modFile);\n}","typeGuard":null,"tryCatchPattern":"try {\n    LocalModFile mod = ForgeNewModMetadata.fromFile(modManager, modFile, tree, type);\n} catch (IOException e) {\n    if (\"Missing embedded mods\".equals(e.getMessage())) {\n        // treat the jar as having no embedded dependencies and skip\n    }\n}","preventionTips":["Ensure jarJar builds declare at least one nested jar","Verify META-INF/jarjar contains both metadata.json and the listed jar files","Do not strip META-INF/jarjar contents when repackaging"],"tags":["minecraft","forge","jar-in-jar","missing-dependency"],"backgroundTag":"missing-dependency","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"}