{"record":{"id":"2a06a23faf9473bf","repo":"languagetool-org/languagetool","slug":"could-not-find-a-source-handler-for-dumpfilename","errorCode":null,"errorMessage":"Could not find a source handler for ${dumpFileName} - Wikipedia files must be named '*.xml', Tatoeba files must be named 'tatoeba-*', CommonCrawl files '*.xz', plain text files '*.txt'","messagePattern":"Could not find a source handler for (.+?) - Wikipedia files must be named '\\*\\.xml', Tatoeba files must be named 'tatoeba-\\*', CommonCrawl files '\\*\\.xz', plain text files '\\*\\.txt'","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"languagetool-wikipedia/src/main/java/org/languagetool/dev/dumpcheck/MixingSentenceSource.java","lineNumber":58,"sourceCode":"\n  public static MixingSentenceSource create(List<String> dumpFileNames, Language language) throws IOException {\n    return create(dumpFileNames, language, null);\n  }\n\n  public static MixingSentenceSource create(List<String> dumpFileNames, Language language, Pattern filter) throws IOException {\n    List<SentenceSource> sources = new ArrayList<>();\n    for (String dumpFileName : dumpFileNames) {\n      File file = new File(dumpFileName);\n      if (file.getName().endsWith(\".xml\")) {\n        sources.add(new WikipediaSentenceSource(new FileInputStream(dumpFileName), language, filter));\n      } else if (file.getName().startsWith(\"tatoeba-\")) {\n        sources.add(new TatoebaSentenceSource(new FileInputStream(dumpFileName), language, filter));\n      } else if (file.getName().endsWith(\".txt\")) {\n        sources.add(new PlainTextSentenceSource(new FileInputStream(dumpFileName), language, filter));\n      } else if (file.getName().endsWith(\".xz\")) {\n        sources.add(new CommonCrawlSentenceSource(new FileInputStream(dumpFileName), language, filter));\n      } else {\n        throw new RuntimeException(\"Could not find a source handler for \" + dumpFileName +\n                \" - Wikipedia files must be named '*.xml', Tatoeba files must be named 'tatoeba-*', CommonCrawl files '*.xz', plain text files '*.txt'\");\n      }\n    }\n    return new MixingSentenceSource(sources, language);\n  }\n\n  private MixingSentenceSource(List<SentenceSource> sources, Language language) {\n    super(language);\n    this.sources = sources;\n  }\n\n  Map<String, Integer> getSourceDistribution() {\n    return sourceDistribution;\n  }\n  \n  @Override\n  public boolean hasNext() {\n    for (SentenceSource source : sources) {","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-wikipedia/src/main/java/org/languagetool/dev/dumpcheck/MixingSentenceSource.java#L40-L76","documentation":"MixingSentenceSource.create dispatches each dump file to a sentence source based on its file name/extension (.xml for Wikipedia, tatoeba-* for Tatoeba, .xz for CommonCrawl, .txt for plain text). If a file matches none of the patterns it throws a RuntimeException explaining the required naming conventions. The extension is the only format selector, so naming is a hard requirement.","triggerScenarios":"Passing a dump file with an unhandled extension such as .bz2, .7z, or no extension; a Tatoeba file not named with the tatoeba- prefix.","commonSituations":"Downloads saved as .xml.bz2 (double extension) not renamed; compressed plain-text files; typos like Tatoeba-2019.txt with capital T and no dash prefix matching.","solutions":["Rename the file to match one of the supported patterns: *.xml, tatoeba-*, *.xz, or *.txt","Decompress double-compressed files (e.g. dump.xml.bz2 -> dump.xml) before passing","Check for case-sensitivity issues in the extension or prefix"],"exampleFix":"// before\njava ... MixingSentenceSource dewiki-latest-pages-articles.xml.bz2\n// after\nbunzip2 dewiki-latest-pages-articles.xml.bz2\njava ... MixingSentenceSource dewiki-latest-pages-articles.xml","handlingStrategy":"validation","validationCode":"File f = new File(dumpFileName);\nString n = f.getName().toLowerCase(Locale.ROOT);\nboolean ok = n.endsWith(\".xml\") || n.startsWith(\"tatoeba-\") || n.endsWith(\".xz\") || n.endsWith(\".txt\");\nif (!ok) throw new IllegalArgumentException(\"Unsupported dump name: \" + n);","typeGuard":null,"tryCatchPattern":"try {\n  MixingSentenceSource.create(dumpFileNames, language, filter);\n} catch (RuntimeException e) {\n  if (e.getMessage() != null && e.getMessage().startsWith(\"Could not find a source handler\")) {\n    System.err.println(\"Rename the dump file per conventions: \" + e.getMessage());\n  } else throw e;\n}","preventionTips":["Normalize dump filenames before processing (bunzip2/gunzip first)","Enforce naming in wrapper scripts","Check extension case-sensitivity","Document required naming in run scripts"],"tags":["file-naming","unsupported-format","configuration"],"backgroundTag":"unsupported-source-format","analyzedSha":"2e990059ce67d5e2a0f7f7ca5d31160c6709df4b","analyzedAt":"2026-09-06T09:20:17.015Z","contentChangedAt":"2026-09-06T09:20:17.015Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}