{"record":{"id":"f0ec874feb1eafaf","repo":"apache/hadoop","slug":"router-is-in-safe-mode-and-cannot-handle-req","errorCode":null,"errorMessage":"Router {} is in safe mode and cannot handle {} requests","messagePattern":"Router (.+?) is in safe mode and cannot handle (.+?) requests","errorType":"exception","errorClass":"StandbyException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcServer.java","lineNumber":884,"sourceCode":"    if (op == OperationCategory.UNCHECKED || op == OperationCategory.READ) {\n      return;\n    }\n    checkSafeMode();\n  }\n\n  /**\n   * Check if the Router is in safe mode.\n   * @throws StandbyException If the Router is in safe mode and cannot serve\n   *                          client requests.\n   */\n  private void checkSafeMode() throws StandbyException {\n    if (isSafeMode()) {\n      // Throw standby exception, router is not available\n      if (rpcMonitor != null) {\n        rpcMonitor.routerFailureSafemode();\n      }\n      OperationCategory op = opCategory.get();\n      throw new StandbyException(\"Router \" + router.getRouterId() +\n          \" is in safe mode and cannot handle \" + op + \" requests\");\n    }\n  }\n\n  /**\n   * Return true if the Router is in safe mode.\n   *\n   * @return true if the Router is in safe mode.\n   */\n  boolean isSafeMode() {\n    RouterSafemodeService safemodeService = router.getSafemodeService();\n    return (safemodeService != null && safemodeService.isInSafeMode());\n  }\n\n  /**\n   * Get the name of the method that is calling this function.\n   *\n   * @return Name of the method calling this function.","sourceCodeStart":866,"sourceCodeEnd":902,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcServer.java#L866-L902","documentation":"Error \"Router {} is in safe mode and cannot handle {} requests\" thrown in apache/hadoop.","triggerScenarios":"A client request reached the Router while it is in safe mode and the request type is blocked in safe mode.","commonSituations":"Clients hitting the Router immediately after startup/restart before it finishes initialization.","solutions":["Wait for the Router to leave safe mode (it exits automatically after startup checks/State Store sync).","Check Router logs for why safe mode persists (State Store unavailable, mount table load failures).","Manually leave safe mode via the Router admin command only after verifying state consistency."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}