juicedata/juicefs · error · IOException

renew token failed, return code %d

Error message

renew token failed, return code %d

What it means

Thrown by renewToken when jfs_renew_token returns a negative code other than EACCESS: the metadata engine failed to extend the delegation token's lifetime. The formatted code identifies the underlying failure.

Source

Thrown at sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java:2435

    identifier.setMasterKeyId(id);

    return new Token<>(
        identifier.getBytes(),
        pwd,
        identifier.getKind(),
        new Text(getCanonicalServiceName()));
  }

  public long renewToken(Token<?> token) throws IOException {
    AbstractDelegationTokenIdentifier identifier = (AbstractDelegationTokenIdentifier) token.decodeIdentifier();
    int id = identifier.getMasterKeyId();
    String pwd = new String(token.getPassword(), StandardCharsets.UTF_8);
    long r = lib.jfs_renew_token(handle, id, pwd);
    if (r == EACCESS) {
      throw new IOException("permission denied");
    }
    if (r < 0) {
      throw new IOException(String.format("renew token failed, return code %d", r));
    }
    return r * 1000;
  }

  public void cancelToken(Token<?> token) throws IOException {
    AbstractDelegationTokenIdentifier identifier = (AbstractDelegationTokenIdentifier) token.decodeIdentifier();
    int id = identifier.getMasterKeyId();
    String pwd = new String(token.getPassword(), StandardCharsets.UTF_8);
    int r = lib.jfs_cancel_token(handle, id, pwd);
    if (r == EACCESS) {
      throw new IOException("permission denied");
    }
    if (r < 0) {
      throw new IOException(String.format("cancel token failed, return code %d", r));
    }
  }
}

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Check metadata engine connectivity and logs for the failing renewal
  2. If the token already expired, obtain a new delegation token instead of renewing
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java:2435 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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