{"record":{"id":"8579ee3b2ec35a98","repo":"juicedata/juicefs","slug":"illegal-value-for-parameter-ranger-rest-url","errorCode":null,"errorMessage":"illegal value for parameter 'ranger-rest-url': \" + url","messagePattern":"illegal value for parameter 'ranger-rest-url': \" \\+ url","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java","lineNumber":618,"sourceCode":"      size = r;\n      buf = Memory.allocate(Runtime.getRuntime(lib), size);\n      r = lib.jfs_ranger_cfg(name, buf, size);\n    }\n    if (r == 0) {\n      return null;\n    }\n    byte[] rBuf = new byte[r];\n    buf.get(0, rBuf, 0, r);\n    String cfgStr = new String(rBuf);\n    // http://localhost:6080?name=service_name\n    String[] split = cfgStr.split(\"\\\\?\", -1);\n    if (split.length != 2) {\n      throw new IOException(String.format(\"wrong ranger config: %s\", cfgStr));\n    }\n    String url = split[0];\n    String serviceName = split[1].substring(5);\n    if (!url.startsWith(\"http\")) {\n      throw new IOException(\"illegal value for parameter 'ranger-rest-url': \" + url);\n    }\n    if (serviceName.isEmpty()) {\n      throw new IOException(\"illegal value for parameter 'ranger-service': \" + serviceName);\n    }\n    String pollIntervalMs = getConf(conf, \"ranger-poll-interval-ms\", \"30000\");\n    return new RangerConfig(url, serviceName, Long.parseLong(pollIntervalMs));\n  }\n\n  public JuiceFileSystemImpl(boolean isSuperGroupFileSystem) {\n    this.isSuperGroupFileSystem = isSuperGroupFileSystem;\n  }\n\n  private Set<String> getGroups() {\n    String groupsFile = getConf(getConf(), \"groups\", null);\n    if (isEmpty(groupsFile)) {\n      return new HashSet<>(ugi.getGroups());\n    }\n","sourceCodeStart":600,"sourceCodeEnd":636,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java#L600-L636","documentation":"After splitting the ranger config string, the URL portion must be an HTTP(S) endpoint. If it does not start with 'http', the client rejects it because the Ranger permission checker polls a REST API and cannot use any other scheme.","triggerScenarios":"The part of the ranger config before '?' does not begin with 'http', e.g. 'ranger-host:6080?name=svc' or 'httpsx://...' (typo).","commonSituations":"Omitting the scheme when writing the Ranger URL; using https:// but a typo removed characters; environment-specific placeholder (e.g. RANGER_URL) left unsubstituted.","solutions":["Prefix the URL with http:// or https:// explicitly.","Verify no placeholder text or whitespace precedes 'http' in the config value.","Test the URL with curl from the client node to confirm the Ranger admin REST endpoint responds."],"exampleFix":"// before\nconf.set(\"juicefs.ranger-config\", \"ranger.internal:6080?name=svc\");\n// after\nconf.set(\"juicefs.ranger-config\", \"https://ranger.internal:6080?name=svc\");","handlingStrategy":"validation","validationCode":"String cfg = conf.get(\"juicefs.ranger-config\");\nString url = cfg == null ? null : cfg.split(\"\\\\?\", -1)[0];\nif (url == null || !url.startsWith(\"http\")) {\n  throw new IllegalArgumentException(\"ranger-rest-url must start with http(s): \" + url);\n}","typeGuard":null,"tryCatchPattern":"try { fs = FileSystem.get(uri, conf); } catch (IOException e) { if (e.getMessage().startsWith(\"illegal value for parameter 'ranger-rest-url'\")) { /* add http:// or https:// */ } throw e; }","preventionTips":["Always include the scheme in Ranger URLs.","Check for unsubstituted placeholders in templated configs.","curl the Ranger URL from client nodes during deployment checks."],"tags":["ranger","url","configuration"],"backgroundTag":"invalid-url-format","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}