{"record":{"id":"8f3d546a21f5cdfd","repo":"HMCL-dev/HMCL","slug":"inheritsfrom","errorCode":null,"errorMessage":"${inheritsFrom}","messagePattern":"\\$\\{inheritsFrom\\}","errorType":"exception","errorClass":"NoSuchGameInstanceException","httpStatus":null,"severity":"error","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/game/DefaultGameRepositorySnapshot.java","lineNumber":258,"sourceCode":"                        : manifest;\n            } else {\n                resolvedManifest = manifest;\n            }\n            resolvedManifest = resolvedManifest.withJar(manifest.jar() == null ? manifest.id() : manifest.jar());\n        } else {\n            if (resolvedSoFar == null) {\n                resolvedSoFar = new HashSet<>();\n            }\n\n            // To maximize the compatibility.\n            if (!resolvedSoFar.add(manifest.id())) {\n                LOG.warning(\"Found circular dependency instances: \" + resolvedSoFar);\n                resolvedManifest = (manifest.jar() == null ? manifest.withJar(manifest.id()) : manifest)\n                        .withInheritsFrom(null);\n            } else {\n                DefaultGameInstance parentInstance = instances.get(manifest.inheritsFrom());\n                if (parentInstance == null) {\n                    throw new NoSuchGameInstanceException(manifest.inheritsFrom());\n                }\n\n                // It is supposed to auto-install a version in getVersion.\n                GameInstanceManifest parentResolved = resolve(parentInstance.getManifest(), resolvedSoFar);\n                resolvedManifest = manifest.merge(parentResolved);\n            }\n        }\n\n        var builder = new GameInstanceManifest.Builder(resolvedManifest);\n\n        if (manifest.patches() != null && !manifest.patches().isEmpty()) {\n            // Assume patches themselves do not have patches recursively.\n            List<GameInstancePatch> sortedPatches = manifest.patches().stream()\n                    .sorted(Comparator.comparing(GameInstancePatch::getPriority))\n                    .toList();\n            for (GameInstancePatch patch : sortedPatches) {\n                builder.merge(patch);\n            }","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/game/DefaultGameRepositorySnapshot.java#L240-L276","documentation":"DefaultGameRepositorySnapshot.resolve walks the inheritsFrom chain of a manifest and throws NoSuchGameInstanceException when a manifest declares a parent instance id that is not registered in the snapshot. The message is the missing parent id. Circular dependencies are handled separately by breaking the chain, but a dangling parent is a hard error.","triggerScenarios":"Resolving (getInstance on a child instance) whose manifest.inheritsFrom names an unregistered/missing id — e.g. child installed while the parent version was never installed or was deleted.","commonSituations":"Deleting a base version (e.g. a vanilla version) that modded children inherit from; copying a version JSON to another launcher without its parent; version JSON edited to point at a nonexistent parent id.","solutions":["Install the missing parent version the manifest inherits from","Point inheritsFrom at an existing registered instance id","Remove the inheritsFrom field to make the instance standalone","Re-scan the repository if the parent exists on disk but is unregistered"],"exampleFix":"// before\n\"inheritsFrom\": \"1.20.1-forge\" // not installed\n// after\n\"inheritsFrom\": \"1.20.1\" // installed parent, or omit to be standalone","handlingStrategy":"try-catch","validationCode":"GameInstanceID parent = manifest.inheritsFrom();\nif (parent != null && !snapshot.hasInstance(parent)) { /* install parent or clear inheritsFrom */ }","typeGuard":"static boolean inheritanceChainResolvable(DefaultGameRepositorySnapshot s, GameInstanceManifest m) {\n    GameInstanceID p = m.inheritsFrom();\n    return p == null || s.hasInstance(p);\n}","tryCatchPattern":"try { instance = snapshot.getInstance(childId); }\ncatch (NoSuchGameInstanceException e) { installParent(e.getMessage()); instance = snapshot.getInstance(childId); }","preventionTips":["Never delete a parent version while children inherit from it","Validate inheritsFrom against registered ids at manifest load time","Break inheritance (set null) for standalone copies of version JSON"],"tags":["instance","inheritance","not-found"],"backgroundTag":"record-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"}