{"record":{"id":"a9507ad9ba54aada","repo":"apache/hadoop","slug":"modification-on-a-read-only-snapshot-is-disallowed","errorCode":null,"errorMessage":"Modification on a read-only snapshot is disallowed","messagePattern":"Modification on a read-only snapshot is disallowed","errorType":"exception","errorClass":"SnapshotAccessControlException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java","lineNumber":1941,"sourceCode":"\n  void checkTraverse(FSPermissionChecker pc, INodesInPath iip,\n      DirOp dirOp) throws AccessControlException, UnresolvedPathException,\n          ParentNotDirectoryException {\n    final boolean resolveLink;\n    switch (dirOp) {\n      case READ_LINK:\n      case WRITE_LINK:\n      case CREATE_LINK:\n        resolveLink = false;\n        break;\n      default:\n        resolveLink = true;\n        break;\n    }\n    checkTraverse(pc, iip, resolveLink);\n    boolean allowSnapshot = (dirOp == DirOp.READ || dirOp == DirOp.READ_LINK);\n    if (!allowSnapshot && iip.isSnapshot()) {\n      throw new SnapshotAccessControlException(\n          \"Modification on a read-only snapshot is disallowed\");\n    }\n  }\n\n  /**\n   * Check whether current user have permissions to access the path. For more\n   * details of the parameters, see\n   * {@link FSPermissionChecker#checkPermission}.\n   */\n  void checkPermission(FSPermissionChecker pc, INodesInPath iip,\n      boolean doCheckOwner, FsAction ancestorAccess, FsAction parentAccess,\n      FsAction access, FsAction subAccess)\n    throws AccessControlException {\n    checkPermission(pc, iip, doCheckOwner, ancestorAccess,\n        parentAccess, access, subAccess, false);\n  }\n\n  /**","sourceCodeStart":1923,"sourceCodeEnd":1959,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java#L1923-L1959","documentation":"Error \"Modification on a read-only snapshot is disallowed\" thrown in apache/hadoop.","triggerScenarios":"Attempting a metadata mutation on a path inside a read-only snapshot.","commonSituations":"See trigger scenarios.","solutions":["Snapshots are read-only; perform the modification on the original directory instead of the snapshot path.","Restore/copy the snapshot content to a writable location before modifying."],"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"}