{"record":{"id":"f4a05fe12e0b7c2e","repo":"languagetool-org/languagetool","slug":"basepath-does-not-exist","errorCode":null,"errorMessage":"basePath does not exist: ","messagePattern":"basePath does not exist: ","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"languagetool-dev/src/main/java/org/languagetool/dev/ExampleSentencePrinter.java","lineNumber":40,"sourceCode":"import org.languagetool.Language;\nimport org.languagetool.Languages;\nimport org.languagetool.rules.IncorrectExample;\nimport org.languagetool.rules.Rule;\n\nimport java.io.File;\nimport java.util.List;\n\n/**\n * Prints the first of the incorrect examples per rule.\n */\nfinal class ExampleSentencePrinter {\n\n  private static final int MAX_BLOCK_SIZE = 5000;\n  \n  private void run(Language lang) {\n    File basePath = new File(\"/home/dnaber/lt/git/languagetool/languagetool-language-modules\");\n    if (!basePath.exists()) {\n      throw new RuntimeException(\"basePath does not exist: \" + basePath);\n    }\n    JLanguageTool tool = new JLanguageTool(lang);\n    System.out.println(\"<html>\");\n    System.out.println(\"<head>\");\n    System.out.println(\"  <title>LanguageTool examples sentences</title>\");\n    System.out.println(\"  <meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html; charset=utf-8\\\" />\");\n    System.out.println(\"</head>\");\n    System.out.println(\"<body>\");\n    int i = 1;\n    int blockSize = 0;\n    for (Rule rule : tool.getAllActiveRules()) {\n      List<IncorrectExample> incorrectExamples = rule.getIncorrectExamples();\n      if (incorrectExamples.size() > 0) {\n        String example = incorrectExamples.get(0).getExample()\n                .replace(\"<marker>\", \"<b>\")\n                .replace(\"</marker>\", \"</b>\");\n        int exampleLength = example.replace(\"<b>\", \"\").replace(\"</b>\", \"\").length();\n        if (blockSize + exampleLength > MAX_BLOCK_SIZE) {","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-dev/src/main/java/org/languagetool/dev/ExampleSentencePrinter.java#L22-L58","documentation":"ExampleSentencePrinter.run relies on a hard-coded developer workspace path (/home/dnaber/lt/git/languagetool/languagetool-language-modules) to locate language module XML files. It throws a RuntimeException at startup when that path does not exist on the current machine.","triggerScenarios":"Running the ExampleSentencePrinter main from any machine where the hard-coded absolute path does not exist — i.e. almost any machine other than the original author's.","commonSituations":"Cloning the languagetool-dev tool and running it on a different OS, different username, or checkout located elsewhere; running it in CI.","solutions":["Create or symlink the expected directory to your actual languagetool-language-modules checkout","Edit ExampleSentencePrinter.java to use a relative path or a system property/environment variable for basePath","Run the script from inside a checkout that matches the expected layout"],"exampleFix":"// before\nFile basePath = new File(\"/home/dnaber/lt/git/languagetool/languagetool-language-modules\");\n// after\nFile basePath = new File(System.getProperty(\"lt.languageModules\", \"languagetool-language-modules\"));","handlingStrategy":"validation","validationCode":"File basePath = new File(\"/home/dnaber/lt/git/languagetool/languagetool-language-modules\");\nif (!basePath.exists()) { throw new IllegalStateException(\"Set lt.languageModules to your checkout; missing: \" + basePath); }","typeGuard":null,"tryCatchPattern":"try { new ExampleSentencePrinter().run(lang); } catch (RuntimeException e) { if (e.getMessage().startsWith(\"basePath does not exist\")) { System.err.println(\"Point the script at your languagetool-language-modules checkout\"); } }","preventionTips":["Replace hard-coded absolute paths with system properties or CLI args in dev scripts","Check the expected directory exists before running the script","Run dev tools from a standard checkout location"],"tags":["hardcoded-path","dev-tool","file-not-found"],"backgroundTag":"directory-not-found","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"}