{"record":{"id":"d3bfc6c983c31430","repo":"languagetool-org/languagetool","slug":"cannot-use-premiumonly-true-with-non-premium-versi","errorCode":null,"errorMessage":"Cannot use premiumOnly=true with non-premium version","messagePattern":"Cannot use premiumOnly=true with non-premium version","errorType":"console","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"languagetool-server/src/main/java/org/languagetool/server/HTTPServerConfig.java","lineNumber":417,"sourceCode":"          throw new IllegalArgumentException(\"Use of cacheTTLSeconds without also setting cacheSize has no effect.\");\n        }\n        cacheTTLSeconds = Integer.parseInt(getOptionalProperty(props, \"cacheTTLSeconds\", \"300\"));\n        maxErrorsPerWordRate = Float.parseFloat(getOptionalProperty(props, \"maxErrorsPerWordRate\", \"0\"));\n        suggestionsEnabled = Boolean.parseBoolean(getOptionalProperty(props, \"suggestionsEnabled\", \"true\"));\n        maxSpellingSuggestions = Integer.parseInt(getOptionalProperty(props, \"maxSpellingSuggestions\", \"0\"));\n        blockedReferrers = Arrays.asList(getOptionalProperty(props, \"blockedReferrers\", \"\").split(\",\\\\s*\"));\n        setTrustedSources(getOptionalProperty(props, \"trustedSources\", null));\n        String premiumAlwaysValue = props.getProperty(\"premiumAlways\");\n        if (premiumAlwaysValue != null) {\n          premiumAlways = Boolean.parseBoolean(premiumAlwaysValue.trim());\n          if (premiumAlways) {\n            System.out.println(\"*** Running in PREMIUM-ALWAYS mode\");\n          }\n        }\n        premiumOnly = Boolean.valueOf(getOptionalProperty(props, \"premiumOnly\", \"false\").trim());\n        if (premiumOnly) {\n          if (!Premium.isPremiumVersion()) {\n            throw new IllegalArgumentException(\"Cannot use premiumOnly=true with non-premium version\");\n          }\n          System.out.println(\"*** Running in PREMIUM-ONLY mode\");\n        }\n        anonymousAccessAllowed = Boolean.valueOf(getOptionalProperty(props, \"anonymousAccessAllowed\", \"true\").trim());\n        if (!anonymousAccessAllowed) {\n          System.out.println(\"*** Running in RESTRICTED-ACCESS mode\");\n        }\n\n        redisHost = getOptionalProperty(props, \"redisHost\", null);\n        redisPort = Integer.parseInt(getOptionalProperty(props, \"redisPort\", \"6379\"));\n        redisDatabase = Integer.parseInt(getOptionalProperty(props, \"redisDatabase\", \"0\"));\n        redisUseSSL = Boolean.valueOf(getOptionalProperty(props, \"redisUseSSL\", \"true\").trim());\n        redisPassword = getOptionalProperty(props, \"redisPassword\", null);\n        redisDictTTL = Integer.parseInt(getOptionalProperty(props, \"redisDictTTLSeconds\", \"600\"));\n        redisTimeout = Integer.parseInt(getOptionalProperty(props, \"redisTimeoutMilliseconds\", \"100\"));\n        redisConnectionTimeout = Integer.parseInt(getOptionalProperty(props, \"redisConnectionTimeoutMilliseconds\", \"5000\"));\n\n        redisCertificate = getOptionalProperty(props, \"redisCertificate\", null);","sourceCodeStart":399,"sourceCodeEnd":435,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-server/src/main/java/org/languagetool/server/HTTPServerConfig.java#L399-L435","documentation":"The 'premiumOnly' server property restricts the server to premium rules/features. It is only valid in a premium build of LanguageTool (checked via Premium.isPremiumVersion()); setting it on the free/open-source build throws this IllegalArgumentException.","triggerScenarios":"Starting the HTTP server with 'premiumOnly=true' in server.properties while running the standard (non-premium) LanguageTool distribution.","commonSituations":"Copy-pasting a premium server's configuration to a community/oss deployment; enabling premium flags while evaluating LanguageTool without a premium license.","solutions":["Remove 'premiumOnly=true' from server.properties when running the free version","Obtain and deploy the premium LanguageTool build/license if premium-only mode is genuinely required","Audit config files copied from premium environments and strip premium-specific keys"],"exampleFix":"// before (server.properties)\npremiumOnly=true\n\n// after (server.properties)\n# premiumOnly removed for non-premium build","handlingStrategy":"validation","validationCode":"if (Boolean.parseBoolean(props.getProperty(\"premiumOnly\", \"false\")) && !isPremiumBuild()) {\n    throw new IllegalStateException(\"premiumOnly=true requires the premium LanguageTool build\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    serverConfig = new HTTPServerConfig(props);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"premiumOnly\")) {\n        props.remove(\"premiumOnly\");\n        serverConfig = new HTTPServerConfig(props);\n    } else { throw e; }\n}","preventionTips":["Keep separate config profiles for premium vs community builds","Never copy server.properties from a premium deployment to a free one without review","Strip premium-only keys (premiumOnly, premium-always mode) in OSS deployments"],"tags":["java","languagetool","licensing","premium","server-config"],"backgroundTag":"feature-not-enabled","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"}