antlr/antlr4 · error

ANTLR installation corrupted; can't load messages format fil

Error message

ANTLR installation corrupted; can't load messages format file:\n + initSTListener.toString()

What it means

Error "ANTLR installation corrupted; can't load messages format file:\n + initSTListener.toString()" thrown in antlr/antlr4.

Source

Thrown at tool/src/org/antlr/v4/tool/ErrorManager.java:251

					panic();
				}
				else if (url == null) {
					rawError("no such message format file " + fileName + " retrying with default ANTLR format");
					setFormat("antlr"); // recurse on this rule, trying the default message format
					return;
				}
				loadedFormat = new STGroupFile(url, "UTF-8", '<', '>');
				loadedFormat.load();

				loadedFormats.put(formatName, loadedFormat);
			}
		}

		this.formatName = formatName;
		this.format = loadedFormat;

		if (!initSTListener.errors.isEmpty()) {
			rawError("ANTLR installation corrupted; can't load messages format file:\n" +
					initSTListener.toString());
			panic();
		}

		boolean formatOK = verifyFormat();
		if (!formatOK && formatName.equals("antlr")) {
			rawError("ANTLR installation corrupted; ANTLR messages format file " + formatName + ".stg incomplete");
			panic();
		}
		else if (!formatOK) {
			setFormat("antlr"); // recurse on this rule, trying the default message format
		}
	}

    /** Verify the message format template group */
    protected boolean verifyFormat() {
        boolean ok = true;
        if (!format.isDefined("location")) {

View on GitHub (pinned to 7d5770395b)

Solutions

  1. Reinstall or rebuild the ANTLR tool; the messages format resource file failed to load (see the listener output appended to the message).
  2. Ensure antlr4 STG resource files (org/antlr/v4/tool/templates/...) are on the classpath and not corrupted or filtered by the build.
  3. If shaded/relocated by a build plugin, include the .stg resources in the shaded jar.

Example fix

// rebuild with resources included: mvn -q -DskipTests package
// and verify jar contains org/antlr/v4/tool/templates/messages/formats/*.stg

When it happens

Trigger: ErrorManager cannot load the ANTLR messages format (.stg) file from the jar/resources at startup.

Common situations: Reinstall ANTLR; the tool jar is corrupted or missing org/antlr/v4/tool/templates messages .stg resources.


AI-assisted analysis of antlr/antlr4@7d5770395b (2026-08-14). Data as JSON: /api/errors/00b5412cfcd6a770. Report an issue: GitHub.