{"record":{"id":"7b277b50216b08b0","repo":"HMCL-dev/HMCL","slug":"installed-theme-pack-file-is-missing","errorCode":null,"errorMessage":"Installed theme-pack file is missing: ","messagePattern":"Installed theme-pack file is missing: ","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"HMCL/src/main/java/org/jackhuang/hmcl/theme/ThemePackManager.java","lineNumber":1220,"sourceCode":"        }\n\n        @Nullable Path file = location.file();\n        if (file == null) {\n            throw new IOException(\"Theme pack location has no readable file: \" + location);\n        }\n        Path installedFile = file.toAbsolutePath().normalize();\n        if (Files.isDirectory(installedFile)) {\n            Path assetFile = installedFile.resolve(normalizedEntryName).normalize();\n            if (!assetFile.startsWith(installedFile)) {\n                throw new IOException(\"Theme-pack asset escapes the installed directory: \" + normalizedEntryName);\n            }\n            if (!Files.isRegularFile(assetFile)) {\n                throw new IOException(\"Installed theme-pack asset is missing: \" + normalizedEntryName);\n            }\n            return new ThemePackResource.File(assetFile, normalizedEntryName);\n        }\n        if (!Files.isRegularFile(installedFile)) {\n            throw new IOException(\"Installed theme-pack file is missing: \" + installedFile);\n        }\n\n        try (ZipArchiveReader zipFile = new ZipArchiveReader(installedFile, StandardCharsets.UTF_8)) {\n            ZipArchiveEntry entry = zipFile.getEntry(normalizedEntryName);\n            if (entry == null || entry.isDirectory()) {\n                throw new IOException(\"Installed theme-pack asset is missing: \" + normalizedEntryName);\n            }\n        }\n        return new ThemePackResource.Zip(installedFile, normalizedEntryName);\n    }\n\n    /// Resolves one asset stored in a bundled theme pack.\n    private static ThemePackResource resolveBuiltinAsset(ThemePackLocation.Builtin builtin, String entryName) throws IOException {\n        String id = ThemePackManifest.requirePackageId(builtin.id());\n        String resourcePath = \"/assets/themes/\" + id + \"/\" + entryName;\n        try (InputStream input = ThemePackManager.class.getResourceAsStream(resourcePath)) {\n            if (input != null) {\n                return new ThemePackResource.Builtin(resourcePath, entryName);","sourceCodeStart":1202,"sourceCodeEnd":1238,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCL/src/main/java/org/jackhuang/hmcl/theme/ThemePackManager.java#L1202-L1238","documentation":"When the theme-pack location is a zip file, resolveInstalledAsset first requires the zip itself to exist and be a regular file. If the pack file is gone or is not a regular file (e.g. a directory at that path), this IOException is thrown with the full path before any zip entry lookup happens.","triggerScenarios":"Calling resolveInstalledAsset() with a zip-backed ThemePackLocation whose file was deleted, moved, renamed, or replaced by a directory after installation.","commonSituations":"The user manually deleting the .zip from the theme-packs directory while settings still reference it; a synced/cleaned Downloads folder where the pack was never installed; portable installs where the packs directory moved.","solutions":["Check Files.isRegularFile(packPath) before resolving and reinstall the pack if missing (ThemePackManager.install).","Point the location at a pack inside the managed theme-packs directory instead of an ad-hoc path.","Refresh stored theme-pack locations after any change to the launcher data directory."],"exampleFix":"// before\nresolveInstalledAsset(location, entry);\n// after\nif (location.file() != null && Files.isRegularFile(location.file())) {\n    resolveInstalledAsset(location, entry);\n}","handlingStrategy":"validation","validationCode":"if (location.file() == null || !Files.isRegularFile(location.file().toAbsolutePath().normalize())) {\n    // pack file missing; reinstall before resolving assets\n    return;\n}","typeGuard":null,"tryCatchPattern":"try {\n    ThemePackManager.resolveInstalledAsset(location, entry);\n} catch (IOException e) {\n    if (e.getMessage().startsWith(\"Installed theme-pack file is missing\")) {\n    // prompt the user to reinstall the pack\n    }\n}","preventionTips":["Install packs into the managed directory instead of referencing downloads","Detect missing pack files at startup and prune stale locations","Avoid moving or renaming pack zips while the launcher references them"],"tags":["theme-pack","assets","zip","missing-file"],"backgroundTag":"file-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"}