juicedata/juicefs · error · IOException

cancel token failed, return code %d

Error message

cancel token failed, return code %d

What it means

Thrown by cancelToken when jfs_cancel_token returns a negative code other than EACCESS: the metadata engine failed to cancel the delegation token, e.g. transient backend errors or an unknown token id.

Source

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

    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. Retry cancellation; if the token id is unknown the token may already have expired and been purged
  2. Check metadata engine logs for the failing cancel request
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java:2449 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/b28ad61e9dbd4766. Report an issue: GitHub.