{"record":{"id":"bcca395c0eaafbd8","repo":"antlr/antlr4","slug":"antlr-installation-corrupted-cannot-find-antlr-me","errorCode":null,"errorMessage":"ANTLR installation corrupted; cannot find ANTLR messages format file  + fileName","messagePattern":"ANTLR installation corrupted; cannot find ANTLR messages format file  \\+ fileName","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"tool/src/org/antlr/v4/tool/ErrorManager.java","lineNumber":232,"sourceCode":"\n    /** The format gets reset either from the Tool if the user supplied a command line option to that effect\n     *  Otherwise we just use the default \"antlr\".\n     */\n    public void setFormat(String formatName) {\n\t\tSTGroupFile loadedFormat;\n\n\t\tsynchronized (loadedFormats) {\n\t\t\tloadedFormat = loadedFormats.get(formatName);\n\t\t\tif (loadedFormat == null) {\n\t\t\t\tString fileName = FORMATS_DIR + formatName + STGroup.GROUP_FILE_EXTENSION;\n\t\t\t\tClassLoader cl = Thread.currentThread().getContextClassLoader();\n\t\t\t\tURL url = cl.getResource(fileName);\n\t\t\t\tif (url == null) {\n\t\t\t\t\tcl = ErrorManager.class.getClassLoader();\n\t\t\t\t\turl = cl.getResource(fileName);\n\t\t\t\t}\n\t\t\t\tif (url == null && formatName.equals(\"antlr\")) {\n\t\t\t\t\trawError(\"ANTLR installation corrupted; cannot find ANTLR messages format file \" + fileName);\n\t\t\t\t\tpanic();\n\t\t\t\t}\n\t\t\t\telse if (url == null) {\n\t\t\t\t\trawError(\"no such message format file \" + fileName + \" retrying with default ANTLR format\");\n\t\t\t\t\tsetFormat(\"antlr\"); // recurse on this rule, trying the default message format\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tloadedFormat = new STGroupFile(url, \"UTF-8\", '<', '>');\n\t\t\t\tloadedFormat.load();\n\n\t\t\t\tloadedFormats.put(formatName, loadedFormat);\n\t\t\t}\n\t\t}\n\n\t\tthis.formatName = formatName;\n\t\tthis.format = loadedFormat;\n\n\t\tif (!initSTListener.errors.isEmpty()) {","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/antlr/antlr4/blob/7d5770395bb7b02eb56e7c62662cb1d7c08f42a3/tool/src/org/antlr/v4/tool/ErrorManager.java#L214-L250","documentation":"Emitted by the ANTLR tool's ErrorManager when the classloader cannot locate the StringTemplate messages group file (org/antlr/v4/tool/templates/messages/format/antlr.stg) that defines all tool message formats. The tool then calls panic(), aborting, because without the format file it cannot render any diagnostics. This almost always means the antlr jar/classpath is broken or incomplete.","triggerScenarios":"Running the ANTLR Tool (antlr4 generation) where the resources directory is missing from the jar, a shaded/repackaged jar dropped the templates, or a custom classloader (e.g. in an app server or build plugin) fails to expose the resource.","commonSituations":"Corrupted download of antlr-4.x-complete.jar, wrong jar on classpath, overly aggressive shading/proguard stripping resources, or running the tool with a non-standard context classloader.","solutions":["Re-download the official antlr-4.x-complete.jar from maven central and replace the broken one","Verify the jar contains org/antlr/v4/tool/templates/messages/formats/ group files: jar tf antlr-4.x-complete.jar | grep messages","Check the build plugin/dependency did not shade or minimize-jar the ANTLR tool resources away","If embedding the tool, ensure the context classloader can see ANTLR resources (Thread.currentThread().setContextClassLoader(...))"],"exampleFix":"# verify jar resources (before: missing -> corrupted)\njar tf antlr-4.13.1-complete.jar | grep 'tool/templates/messages'\n\n# after: re-fetch the official artifact\nmvn org.apache.maven.plugins:maven-dependency-plugin:3.6.1:get \\\n  -Dartifact=org.antlr:antlr4:4.13.1","handlingStrategy":"validation","validationCode":"// verify the tool jar carries its message templates before invoking it\nClassLoader cl = ErrorManager.class.getClassLoader();\nif (cl.getResource(\"org/antlr/v4/tool/templates/messages/formats/antlr.stg\") == null) {\n    throw new IllegalStateException(\"antlr jar incomplete: missing messages format file\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the official antlr-4.x-complete.jar from Maven Central","Avoid shading/minimizing the ANTLR tool jar in build plugins","Verify jar integrity with 'jar tf ... | grep messages' after any packaging change"],"tags":["antlr","java","tool","installation","classpath"],"backgroundTag":null,"analyzedSha":"7d5770395bb7b02eb56e7c62662cb1d7c08f42a3","analyzedAt":"2026-08-14T14:47:56.354Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}