HMCL-dev/HMCL · error · JsonParseException

FileInformation missing `path`.

Error message

FileInformation missing `path`.

What it means

HMCL's ModpackConfiguration.FileInformation.validate() throws JsonParseException when a file entry in a modpack configuration JSON lacks the required `path` field. Every file entry must state its relative path so HMCL knows where to place/verify it. This is a strict schema check run during modpack install/update.

Solutions

  1. Fix the modpack configuration JSON so every files[] entry has a non-null `path`
  2. Re-download/re-export the modpack to regenerate a valid configuration file
  3. Regenerate FileInformation objects programmatically ensuring path is set before validate()

Example fix

// before
{"files":[{"hash":"abc123"}]}
// after
{"files":[{"path":"mods/foo.jar","hash":"abc123"}]}
Defensive patterns

Strategy: validation

Validate before calling

if (info.getPath() == null) throw new IllegalArgumentException("FileInformation entry missing path: " + info);
for (FileInformation f : config.getFiles()) { if (f.getPath() == null || f.getHash() == null) { /* repair or reject */ } }

Type guard

boolean isValid(FileInformation f) { return f != null && f.getPath() != null && f.getHash() != null; }

Try / catch

try { fileInformation.validate(); } catch (JsonParseException e) { log.error("Bad modpack file entry", e); /* skip or reinstall */ }

Prevention

When it happens

Trigger: Parsing a modpack configuration JSON (modpack.cfg-style) whose files[] entry has a null/missing `path` field, then calling validate() on the deserialized FileInformation.

Common situations: Hand-edited or third-party-generated modpack config files, partially written/corrupted config JSON, or a modpack format change where the field was renamed.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of HMCL-dev/HMCL@24702dc5a0 (2026-09-10). Data as JSON: /api/errors/87bab4d983e3642c. Report an issue: GitHub.

Appendix: source

Thrown at HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/ModpackConfiguration.java:137

         *
         * @return the relative path to Minecraft run directory.
         */
        public String getPath() {
            return path;
        }

        public String getDownloadURL() {
            return downloadURL;
        }

        public String getHash() {
            return hash;
        }

        @Override
        public void validate() throws JsonParseException {
            if (path == null)
                throw new JsonParseException("FileInformation missing `path`.");
            if (hash == null)
                throw new JsonParseException("FileInformation missing file hash code.");
        }
    }
}

View on GitHub (pinned to 24702dc5a0)