Skip to content

Diagnostics

Minecraft is lenient about pack.mcmeta. A pack with a good pack section and a broken language block loads in game — the parser ignores what it cannot read. This library matches that: a pack that works in Minecraft identifies here, and everything questionable is reported alongside the result rather than failing it.

IdentificationResult.Identified identified = ...;

List<DiagnosticCode> codes = identified.diagnostics().stream().map(Diagnostic::code).toList();

assertTrue(codes.contains(DiagnosticCode.LEGACY_FORMATTING_CODES));

Each Diagnostic is a code plus a human-readable detail.

What is fatal

Only the pack section. A missing or unparseable pack section, or one with no usable format declaration, yields Malformed. Everything else degrades into a diagnostic.

The codes

Reading

Code When
BYTE_ORDER_MARK_STRIPPED The file began with a UTF-8 BOM, which was removed before parsing. Windows editors add these and they break strict parsers

Format declaration

Code When
INVERTED_FORMAT_RANGE The range runs backwards, e.g. min_format 88 with max_format 69. The bounds were swapped
INCOMPLETE_FORMAT_RANGE Only one of min_format / max_format was given. Both are required since 1.21.9, so the range was narrowed to that single format rather than assuming an open end
MALFORMED_FORMAT_VALUE A format value was present but was not a whole number or a pair of them, so it was ignored
INCONSISTENT_FORMAT_DECLARATION pack_format falls outside the declared supported_formats

Optional sections

Code When
MALFORMED_LANGUAGE_SECTION language was not an object and was dropped
MALFORMED_LANGUAGE_ENTRY One language entry lacked a name and was skipped
MALFORMED_FILTER_SECTION filter was not an object, or had no block array
MALFORMED_FILTER_ENTRY A block entry was not an object, or had neither namespace nor path
MALFORMED_OVERLAYS_SECTION overlays was not an object, or had no entries array
MALFORMED_OVERLAY_ENTRY An overlay lacked a directory or a usable format range and was skipped
UNKNOWN_SECTION A top-level section this library does not interpret. It is preserved verbatim in unknownSections(), not discarded

Description

Code When
LEGACY_FORMATTING_CODES The description contains § colour codes. They are kept exactly as written; this only tells you they are there so you can decide how to render
MISSING_DESCRIPTION The pack section has no description. Treated as empty rather than fatal

Lenient JSON

The game parses pack.mcmeta with Gson in lenient mode, so hand-edited packs in the wild contain things that are not legal JSON and still work in Minecraft. This library accepts the same:

  • // and /* */ comments
  • single-quoted strings
  • unquoted field names
  • trailing commas
  • unescaped control characters

Two gaps remain against the game's own leniency: unquoted string values ({description: my pack}) and = or ; as separators. Those parse in Minecraft but not here.