languagetool-org/languagetool · error · IllegalArgumentException
Cannot use --premiumAlways with non-premium version
Error message
Cannot use --premiumAlways with non-premium version
What it means
HTTPServerConfig rejects the --premiumAlways CLI flag when the running build is not the premium version of LanguageTool. The flag enables premium features without authentication, which only exists in premium builds, so the constructor throws IllegalArgumentException to fail fast.
Source
Thrown at languagetool-server/src/main/java/org/languagetool/server/HTTPServerConfig.java:267
}
switch (args[i]) {
case "--config":
parseConfigFile(new File(args[++i]), !ArrayUtils.contains(args, LANGUAGE_MODEL_OPTION));
break;
case "-p":
case "--port":
port = Integer.parseInt(args[++i]);
break;
case "-v":
case "--verbose":
verbose = true;
break;
case "--public":
publicAccess = true;
break;
case "--premiumAlways":
if (!Premium.isPremiumVersion()) {
throw new IllegalArgumentException("Cannot use --premiumAlways with non-premium version");
}
premiumAlways = true;
System.out.println("*** Running in PREMIUM-ALWAYS mode, premium features are available without authentication");
break;
case "--allow-origin":
try {
allowOriginUrl = args[++i];
if (allowOriginUrl.startsWith("--")) { // no parameter, next option starts instead
allowOriginUrl = "*";
i--;
}
} catch (ArrayIndexOutOfBoundsException e) {
allowOriginUrl = "*";
}
break;
case LANGUAGE_MODEL_OPTION:
setLanguageModelDirectory(args[++i]);
break;View on GitHub (pinned to 2e990059ce)
Solutions
- Remove --premiumAlways from the command line when running the non-premium server
- Use the premium LanguageTool server build if premium-always behavior is required
- Review startup scripts/containers for the flag and make it conditional on the build type
Example fix
# before java -cp languagetool-server.jar org.languagetool.server.HTTPServer --port 8081 --premiumAlways # after java -cp languagetool-server.jar org.languagetool.server.HTTPServer --port 8081
Defensive patterns
Strategy: validation
Validate before calling
// guard launch args for non-premium builds
boolean premium = isPremiumJar();
List<String> safe = Arrays.stream(args).filter(a -> premium || !a.equals("--premiumAlways")).collect(toList());
if (!premium && args.length != safe.size()) warn("--premiumAlways removed: non-premium build"); Try / catch
try { cfg = new HTTPServerConfig(args); } catch (IllegalArgumentException e) {
if (e.getMessage().contains("--premiumAlways")) { args = removeFlag(args, "--premiumAlways"); cfg = new HTTPServerConfig(args); } else throw e;
} Prevention
- Keep separate launch scripts for free vs premium server builds
- Assert the expected jar/build type in deployment scripts
- Document build-specific flags in the ops runbook
When it happens
Trigger: Passing --premiumAlways on the command line to the open-source (non-premium) languagetool-server jar.
Common situations: Reusing a startup script written for the premium server with the free server; upgrading/downgrading between builds while keeping the same launch arguments.
Related errors
- Invalid port configuration found. The value for '--port' nee
- Missing argument for '--logIpMatchingPattern' (e.g. any rand
- WrongParameterNumberException
- No rules are active. Please make sure your rule ids (<option
- suppressMisspelledMatch must be a valid regex
AI-assisted analysis of languagetool-org/languagetool@2e990059ce (2026-09-06).
Data as JSON: /api/errors/5c7442f003c824ef.
Report an issue: GitHub.