{"record":{"id":"add1af28f767f071","repo":"apache/hadoop","slug":"failed-to-create-snapshot-there-are-already-sn","errorCode":null,"errorMessage":"Failed to create snapshot: there are already {} snapshot(s) and the {} snapshot limit is {}","messagePattern":"Failed to create snapshot: there are already (.+?) snapshot\\(s\\) and the (.+?) snapshot limit is (.+?)","errorType":"exception","errorClass":"SnapshotException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/snapshot/SnapshotManager.java","lineNumber":489,"sourceCode":"  }\n\n  void checkFileSystemSnapshotLimit(int n) throws SnapshotException {\n    checkSnapshotLimit(maxSnapshotFSLimit, n, \"file system\");\n  }\n\n  void checkPerDirectorySnapshotLimit(int n) throws SnapshotException {\n    checkSnapshotLimit(maxSnapshotLimit, n, \"per directory\");\n  }\n\n  void checkSnapshotLimit(int limit, int snapshotCount, String type)\n      throws SnapshotException {\n    if (snapshotCount >= limit) {\n      String msg = \"there are already \" + snapshotCount\n          + \" snapshot(s) and the \"  + type + \" snapshot limit is \"\n          + limit;\n      if (isImageLoaded()) {\n        // We have reached the maximum snapshot limit\n        throw new SnapshotException(\n            \"Failed to create snapshot: \" + msg);\n      } else {\n        // image is getting loaded. LOG an error msg and continue\n        LOG.error(msg);\n      }\n    }\n  }\n\n  boolean isImageLoaded() {\n    return fsdir.isImageLoaded();\n  }\n  /**\n   * Delete a snapshot for a snapshottable directory\n   * @param snapshotName Name of the snapshot to be deleted\n   * @param now is the snapshot deletion time set by Time.now().\n   * @param reclaimContext Used to collect information to reclaim blocks\n   *                       and inodes\n   */","sourceCodeStart":471,"sourceCodeEnd":507,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/snapshot/SnapshotManager.java#L471-L507","documentation":"Error \"Failed to create snapshot: there are already {} snapshot(s) and the {} snapshot limit is {}\" thrown in apache/hadoop.","triggerScenarios":"createSnapshot exceeds the configured snapshot count limit for the directory or system.","commonSituations":"Automated snapshot schedules accumulating snapshots until the limit is reached.","solutions":["Delete unneeded snapshots or raise the per-directory snapshot limit (dfs.namenode.snapshot.max.allow.snapshots) if justified."],"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-22T20:17:22.307Z"}