{"record":{"id":"9e2b858756a623e0","repo":"juicedata/juicefs","slug":"illegal-value-for-parameter-ranger-service","errorCode":null,"errorMessage":"illegal value for parameter 'ranger-service': \" + serviceName","messagePattern":"illegal value for parameter 'ranger-service': \" \\+ serviceName","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java","lineNumber":621,"sourceCode":"    }\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\n    int size = 0, r = 1 << 10;\n    Pointer buf = null;\n    while (r > size) {","sourceCodeStart":603,"sourceCodeEnd":639,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java#L603-L639","documentation":"The ranger config's query part must be 'name=<service_name>'; the code strips the fixed 5-character 'name=' prefix and requires the remaining service name to be non-empty. An empty service name would make Ranger policy lookups meaningless, so initialization throws this IOException.","triggerScenarios":"Ranger config like 'http://ranger:6080?name=' (nothing after 'name='), or the part after '?' not starting with 'name=' so the substring(5) yields an empty/wrong string.","commonSituations":"Leaving the service_name blank in the config template; writing '?service=svc' instead of '?name=svc' so substring(5) produces the wrong/empty value; the Ranger service was never created so admins omitted the name.","solutions":["Set the full config to 'http://<ranger-host>:6080?name=<existing-service-name>'.","Confirm the query part literally starts with 'name=' (not 'service=' or 'servicename=').","Create the corresponding service in the Ranger admin console if it does not exist, then use that exact name."],"exampleFix":"// before\nconf.set(\"juicefs.ranger-config\", \"http://ranger:6080?name=\");\n// after\nconf.set(\"juicefs.ranger-config\", \"http://ranger:6080?name=hadoop_jfs\");","handlingStrategy":"validation","validationCode":"String cfg = conf.get(\"juicefs.ranger-config\");\nif (cfg != null) {\n  String q = cfg.split(\"\\\\?\", -1).length == 2 ? cfg.split(\"\\\\?\", -1)[1] : \"\";\n  String svc = q.startsWith(\"name=\") ? q.substring(5) : null;\n  if (svc == null || svc.isEmpty()) {\n    throw new IllegalArgumentException(\"ranger config must end with ?name=<non-empty service>\");\n  }\n}","typeGuard":null,"tryCatchPattern":"try { fs = FileSystem.get(uri, conf); } catch (IOException e) { if (e.getMessage().startsWith(\"illegal value for parameter 'ranger-service'\")) { /* set a real service name */ } throw e; }","preventionTips":["Create the Ranger service first; copy the exact service name from the Ranger admin UI.","Use 'name=' (not 'service=') in the config string.","Validate configs in CI before shipping to the cluster."],"tags":["ranger","configuration","validation"],"backgroundTag":"empty-required-field","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"}