{"record":{"id":"a5b0aeecc294dc7e","repo":"pentaho/pentaho-kettle","slug":"failed-to-retry-repository-operation-after-reconnect","errorCode":null,"errorMessage":"Failed to retry repository operation after reconnect","messagePattern":"Failed to retry repository operation after reconnect","errorType":"exception","errorClass":"SessionRecoveryRetryException","httpStatus":null,"severity":"error","filePath":"plugins/repositories/core/src/main/java/org/pentaho/di/ui/repo/timeout/RepositorySessionTimeoutHandler.java","lineNumber":148,"sourceCode":"    }\n  }\n\n  private Object reconnectAndRetry( Method method, Object[] args )\n      throws SessionRecoveryRetryException {\n    try {\n      ConnectionManager.getInstance().reset();\n    } catch ( Exception ce ) {\n      // Intentionally ignore cache reset errors - they should not prevent reconnection\n    }\n    try {\n      metaStoreInstance = wrapMetastoreWithTimeoutHandler( MetaStoreConst.getDefaultMetastore(), sessionTimeoutHandler );\n    } catch ( Exception me ) {\n      // Intentionally ignore metastore refresh errors - they should not prevent reconnection\n    }\n    try {\n      return method.invoke( this.repository, args );\n    } catch ( InvocationTargetException retryEx ) {\n      throw new SessionRecoveryRetryException( \"Failed to retry repository operation after reconnect\",\n          retryEx.getCause() );\n    } catch ( IllegalAccessException | IllegalArgumentException retryEx ) {\n      throw new SessionRecoveryRetryException( \"Unable to invoke repository operation after reconnect\", retryEx );\n    }\n  }\n\n  static class SessionRecoveryRetryException extends KettleException {\n    private static final long serialVersionUID = 1L;\n\n    SessionRecoveryRetryException( String message, Throwable cause ) {\n      super( message, cause );\n    }\n  }\n\n  boolean connectedToRepository() {\n    return repository.isConnected();\n  }\n","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/repositories/core/src/main/java/org/pentaho/di/ui/repo/timeout/RepositorySessionTimeoutHandler.java#L130-L166","documentation":"RepositorySessionTimeoutHandler.reconnectAndRetry re-invokes the original repository method via reflection after reconnecting. If the retried invocation itself throws (InvocationTargetException), it wraps the cause in SessionRecoveryRetryException('Failed to retry repository operation after reconnect'). The reconnection succeeded but the retried operation failed again.","triggerScenarios":"After a session timeout, the handler reconnects and retries the original method, and that retry throws any exception (e.g. file still missing, permissions changed, server error).","commonSituations":"File was deleted server-side during the disconnect window; retry hits a different server error; the operation is not idempotent and fails on second attempt.","solutions":["Inspect getCause() of the SessionRecoveryRetryException to find the real retry failure and fix that underlying problem","Verify the target file/folder still exists after reconnection before retrying","Retry the operation manually from the UI after confirming repository state","Avoid modifying repository state between timeout and retry (idempotency)"],"exampleFix":"// before\nhandler.handle( proxy, method, args ); // wraps retry failures opaquely\n// after\ntry {\n  handler.handle( proxy, method, args );\n} catch ( KettleException e ) {\n  Throwable root = e.getCause();\n  log.error( \"Retry failed due to\", root ); // diagnose real cause\n}","handlingStrategy":"retry","validationCode":"// before relying on retry, check state\nif ( !fileObject.exists() ) { refreshOrRelocate(); }","typeGuard":null,"tryCatchPattern":"try {\n  handler.handle( proxy, method, args );\n} catch ( SessionRecoveryRetryException e ) {\n  Throwable root = e.getCause();\n  log.error( \"Retry after reconnect failed:\", root );\n  // fall back to manual re-execution by the user\n}","preventionTips":["Make retried operations idempotent so a second attempt is safe","Re-verify file existence/permissions after reconnection before retry","Read getCause() to diagnose the real failure rather than the wrapper","Check server logs for the exception thrown during the retried call"],"tags":["reflection","session","retry","repository"],"backgroundTag":"retry-failed-after-reconnect","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}