{"record":{"id":"b28ad61e9dbd4766","repo":"juicedata/juicefs","slug":"cancel-token-failed-return-code-d","errorCode":null,"errorMessage":"cancel token failed, return code %d","messagePattern":"cancel token failed, return code (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java","lineNumber":2449,"sourceCode":"    if (r == EACCESS) {\n      throw new IOException(\"permission denied\");\n    }\n    if (r < 0) {\n      throw new IOException(String.format(\"renew token failed, return code %d\", r));\n    }\n    return r * 1000;\n  }\n\n  public void cancelToken(Token<?> token) throws IOException {\n    AbstractDelegationTokenIdentifier identifier = (AbstractDelegationTokenIdentifier) token.decodeIdentifier();\n    int id = identifier.getMasterKeyId();\n    String pwd = new String(token.getPassword(), StandardCharsets.UTF_8);\n    int r = lib.jfs_cancel_token(handle, id, pwd);\n    if (r == EACCESS) {\n      throw new IOException(\"permission denied\");\n    }\n    if (r < 0) {\n      throw new IOException(String.format(\"cancel token failed, return code %d\", r));\n    }\n  }\n}\n","sourceCodeStart":2431,"sourceCodeEnd":2453,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java#L2431-L2453","documentation":"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.","triggerScenarios":"Thrown at sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java:2449 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry cancellation; if the token id is unknown the token may already have expired and been purged","Check metadata engine logs for the failing cancel request"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}