{"record":{"id":"88fb749c1fc40482","repo":"juicedata/juicefs","slug":"wrong-ranger-config-s","errorCode":null,"errorMessage":"wrong ranger config: %s","messagePattern":"wrong ranger config: (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java","lineNumber":613,"sourceCode":"      return config;\n    }\n    int size = 0, r = 1 << 10;\n    Pointer buf = null;\n    while (r > size) {\n      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() {","sourceCodeStart":595,"sourceCodeEnd":631,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java#L595-L631","documentation":"The Ranger permission configuration is passed as a single string that must have exactly the form '<rest-url>?name=<service-name>'. The client splits on '?' and throws this IOException when the string does not contain exactly one '?' (i.e., not exactly two parts).","triggerScenarios":"Setting the ranger config (e.g. juicefs.ranger-config or the value delivered via the config service) to a string without exactly one '?' separator, or with multiple '?' characters.","commonSituations":"Typing the Ranger REST URL without the '?name=service' suffix; pasting a URL that already contains query parameters; URL-encoding or extra whitespace breaking the split; forgetting the service_name portion.","solutions":["Set the config to exactly 'http://ranger-host:6080?name=<service_name>'.","Ensure there is exactly one '?' and the part after it starts with 'name='.","Remove any extra query parameters or trailing slashes from the URL.","Print the received config string in the error message (it is included) and compare character-by-character."],"exampleFix":"// before\nconf.set(\"juicefs.ranger-config\", \"http://ranger:6080\"); // no ?name=...\n// after\nconf.set(\"juicefs.ranger-config\", \"http://ranger:6080?name=juicefs_service\");","handlingStrategy":"validation","validationCode":"String cfg = conf.get(\"juicefs.ranger-config\");\nif (cfg != null && cfg.split(\"\\\\?\", -1).length != 2) {\n  throw new IllegalArgumentException(\"ranger config must be <url>?name=<service>: \" + cfg);\n}","typeGuard":null,"tryCatchPattern":"try { fs = FileSystem.get(uri, conf); } catch (IOException e) { if (e.getMessage().startsWith(\"wrong ranger config\")) { /* correct the config string */ } throw e; }","preventionTips":["Store the exact 'http://host:6080?name=service' string in config management.","Never add extra query parameters to the ranger config value.","Validate the string with a regex ^https?://[^?]+\\?name=.+$ before deployment."],"tags":["ranger","configuration","format"],"backgroundTag":"invalid-config-value","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"}