languagetool-org/languagetool · error · RuntimeException

Fasttext binary path not valid (file doesn't exist, is a dir

Error message

Fasttext binary path not valid (file doesn't exist, is a directory or not executable): 

What it means

Configuration validation in setFasttextPaths: the fasttext binary file does not exist, is a directory, or is not executable, so fasttext predictions cannot run.

Source

Thrown at languagetool-server/src/main/java/org/languagetool/server/HTTPServerConfig.java:572

    }
  }

  public void setLanguageModelDirectory(String langModelDir) {
    SuggestionsOrdererConfig.setNgramsPath(langModelDir);
    languageModelDir = new File(langModelDir);
    if (!languageModelDir.exists() || !languageModelDir.isDirectory()) {
      throw new RuntimeException("LanguageModel directory not found or is not a directory: " + languageModelDir);
    }
  }

  void setFasttextPaths(String fasttextModelPath, String fasttextBinaryPath) {
    fasttextModel = new File(fasttextModelPath);
    fasttextBinary = new File(fasttextBinaryPath);
    if (!fasttextModel.exists() || fasttextModel.isDirectory()) {
      throw new RuntimeException("Fasttext model path not valid (file doesn't exist or is a directory): " + fasttextModelPath);
    }
    if (!fasttextBinary.exists() || fasttextBinary.isDirectory() || !fasttextBinary.canExecute()) {
      throw new RuntimeException("Fasttext binary path not valid (file doesn't exist, is a directory or not executable): " + fasttextBinaryPath);
    }
  }

  /*
   * @param verbose if true, the text to be checked will be displayed in case of exceptions
   */
  public boolean isVerbose() {
    return verbose;
  }

  public boolean isPublicAccess() {
    return publicAccess;
  }

  public int getPort() {
    return port;
  }

View on GitHub (pinned to 2e990059ce)

Solutions

  1. Run `chmod +x <binaryPath>` to make the fasttext binary executable
  2. Build or install fasttext and point the option at the compiled executable file
  3. Verify with `ls -l` and test execution directly: `<binaryPath> --help`

Example fix

// before
chmod 644 /opt/fasttext/fasttext
// after
chmod +x /opt/fasttext/fasttext
Defensive patterns

Strategy: validation

Validate before calling

File bin = new File(fasttextBinaryPath);
if (!bin.isFile() || !bin.canExecute())
  throw new IllegalStateException("fasttext binary not executable: " + fasttextBinaryPath);

Try / catch

try {
  config.setFasttextPaths(modelPath, binaryPath);
} catch (RuntimeException e) {
  LOG.error("fasttext binary invalid: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Calling setFasttextPaths(modelPath, binaryPath) (or the --fasttextBinary server option) where the binary is absent, points to a directory, or lacks the execute permission bit.

Common situations: fasttext not compiled/installed, binary downloaded but `chmod +x` never applied, path pointing to source directory instead of the compiled executable, or running under a user without execute permission.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of languagetool-org/languagetool@2e990059ce (2026-09-06). Data as JSON: /api/errors/646d2a5655938116. Report an issue: GitHub.