HMCL-dev/HMCL · error · JsonParseException

ServerModpackManifest.fileApi cannot be blank

Error message

ServerModpackManifest.fileApi cannot be blank

What it means

Validation error thrown when parsing a server modpack manifest (modpack.json) whose 'fileApi' field is missing (null). The fileApi URL is mandatory because the client needs it to download the modpack's files, so the manifest is rejected as invalid.

Solutions

  1. Add the required 'fileApi' field (base URL of the file server) to the manifest JSON.
  2. Re-download the manifest from the server; the copy may be truncated or corrupted.
  3. If you run the server, fix your manifest-generation tool to always emit 'fileApi'.

Example fix

// before
{ "name": "my pack", "files": [...] }
// after
{ "name": "my pack", "fileApi": "https://example.com/files", "files": [...] }
Defensive patterns

Strategy: validation

Validate before calling

JsonObject manifest = JsonUtils.fromJson(json, JsonObject.class);
if (!manifest.has("fileApi") || manifest.get("fileApi").isJsonNull())
    throw new JsonParseException("manifest missing fileApi");

Try / catch

try {
    manifest.validate();
} catch (JsonParseException e) {
    if (e.getMessage().contains("fileApi cannot be blank")) {
        // re-download or fix the manifest
    }
}

Prevention

When it happens

Trigger: ServerModpackManifest.validate() runs after JSON deserialization and fileApi is null — the manifest JSON omits the 'fileApi' key or it was explicitly set to null.

Common situations: Hand-edited or truncated manifest files; a server operator generating manifests with a buggy tool; downloading a manifest over a broken connection that cut off part of the JSON.

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/5745dbe89b54f222. Report an issue: GitHub.

Appendix: source

Thrown at HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/server/ServerModpackManifest.java:97

    }

    public List<ModpackConfiguration.FileInformation> getFiles() {
        return files;
    }

    public List<Addon> getAddons() {
        return addons;
    }

    @Override
    public ModpackProvider getProvider() {
        return ServerModpackProvider.INSTANCE;
    }

    @Override
    public void validate() throws JsonParseException, TolerableValidationException {
        if (fileApi == null)
            throw new JsonParseException("ServerModpackManifest.fileApi cannot be blank");
        if (files == null)
            throw new JsonParseException("ServerModpackManifest.files cannot be null");
    }

    public static final class Addon {
        private final String id;
        private final String version;

        public Addon() {
            this("", "");
        }

        public Addon(String id, String version) {
            this.id = id;
            this.version = version;
        }

        public String getId() {

View on GitHub (pinned to 24702dc5a0)