juicedata/juicefs · error · IOException

renew token failed

Error message

renew token failed

What it means

JuiceFSTokenRenewer.renew throws this IOException when the FileSystem obtained for the token's service URI is not a JuiceFileSystem (FilterFileSystem wrapping JuiceFileSystemImpl). Only JuiceFS tokens can be renewed by this renewer; anything else is rejected.

Source

Thrown at sdk/java/src/main/java/io/juicefs/kerberos/JuiceFSTokenRenewer.java:49

  @Override
  public boolean handleKind(Text kind) {
    return JuiceFSDelegationTokenIdentifier.TOKEN_KIND.equals(kind);
  }

  @Override
  public boolean isManaged(Token<?> token) throws IOException {
    return true;
  }

  @Override
  public long renew(Token<?> token, Configuration configuration) throws IOException, InterruptedException {
    String service = token.getService().toString();
    FileSystem fs = FileSystem.get(URI.create(service), configuration);
    if (fs instanceof JuiceFileSystem) {
      return ((JuiceFileSystemImpl) ((FilterFileSystem) fs).getRawFileSystem()).renewToken(token);
    }
    throw new IOException("renew token failed");
  }

  @Override
  public void cancel(Token<?> token, Configuration configuration) throws IOException, InterruptedException {
    String service = token.getService().toString();
    FileSystem fs = FileSystem.get(URI.create(service), configuration);
    if (fs instanceof JuiceFileSystem) {
      ((JuiceFileSystemImpl) ((FilterFileSystem) fs).getRawFileSystem()).cancelToken(token);
      return;
    }
    throw new IOException("cancel token failed");
  }
}

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Verify the token's service URI uses the juicefs scheme and fs.juicefs.impl maps to JuiceFileSystem
  2. Ensure the renewer name on the token matches the JuiceFS renewer only for JuiceFS-issued tokens
  3. Check that FileSystem.get returns a FilterFileSystem wrapping JuiceFileSystemImpl (as configured in core-site.xml)
  4. Renew the token directly on the JuiceFS client instead of via the generic Hadoop renewer

Example fix

// before
FileSystem fs = FileSystem.get(URI.create(service), configuration);
((JuiceFileSystemImpl) ((FilterFileSystem) fs).getRawFileSystem()).renewToken(token);
// after
FileSystem fs = FileSystem.get(URI.create(service), configuration);
if (!(fs instanceof JuiceFileSystem)) {
  LOG.warn("Cannot renew token for non-JuiceFS filesystem: " + service);
  return;
}
Defensive patterns

Strategy: try-catch

Validate before calling

FileSystem fs = FileSystem.get(URI.create(token.getService().toString()), conf);
boolean canRenew = fs instanceof JuiceFileSystem;

Type guard

boolean isJuiceFsToken(Token<?> t, Configuration c) {
  try { return FileSystem.get(URI.create(t.getService().toString()), c) instanceof JuiceFileSystem; }
  catch (Exception e) { return false; }
}

Try / catch

try {
  renewer.renew(token, conf);
} catch (IOException e) {
  if ("renew token failed".equals(e.getMessage())) {
    LOG.warn("Token is not a JuiceFS token; skip renewal", e);
  } else throw e;
}

Prevention

When it happens

Trigger: Hadoop's DelegationTokenRenewer (testToken path) calls renew(token, conf); token.getService() resolves to a non-JuiceFS filesystem, or FileSystem.get returns an unwrapped/different fs instance (e.g. service URI scheme not juicefs or no FilterFileSystem wrapper).

Common situations: Token renewal thread picking up a foreign token with a renewer name that maps to JuiceFSTokenRenewer; service URI misconfiguration; filesystem not initialized as JuiceFileSystem in the cluster config; running renewer on a node where fs.impl mappings differ.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/58a745e474f816c3. Report an issue: GitHub.