{"record":{"id":"02da0249b2d691e8","repo":"apache/hadoop","slug":"createchecksumtype-option-is-set-multiple-times","errorCode":null,"errorMessage":"CreateChecksumType option is set multiple times","messagePattern":"CreateChecksumType option is set multiple times","errorType":"validation","errorClass":"HadoopIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/AbstractFileSystem.java","lineNumber":572,"sourceCode":"          throw new HadoopIllegalArgumentException(\n              \"BufferSize option is set multiple times\");\n        }\n        bufferSize = ((CreateOpts.BufferSize) iOpt).getValue();\n      } else if (CreateOpts.ReplicationFactor.class.isInstance(iOpt)) {\n        if (replication != -1) {\n          throw new HadoopIllegalArgumentException(\n              \"ReplicationFactor option is set multiple times\");\n        }\n        replication = ((CreateOpts.ReplicationFactor) iOpt).getValue();\n      } else if (CreateOpts.BytesPerChecksum.class.isInstance(iOpt)) {\n        if (bytesPerChecksum != -1) {\n          throw new HadoopIllegalArgumentException(\n              \"BytesPerChecksum option is set multiple times\");\n        }\n        bytesPerChecksum = ((CreateOpts.BytesPerChecksum) iOpt).getValue();\n      } else if (CreateOpts.ChecksumParam.class.isInstance(iOpt)) {\n        if (checksumOpt != null) {\n          throw new  HadoopIllegalArgumentException(\n              \"CreateChecksumType option is set multiple times\");\n        }\n        checksumOpt = ((CreateOpts.ChecksumParam) iOpt).getValue();\n      } else if (CreateOpts.Perms.class.isInstance(iOpt)) {\n        if (permission != null) {\n          throw new HadoopIllegalArgumentException(\n              \"Perms option is set multiple times\");\n        }\n        permission = ((CreateOpts.Perms) iOpt).getValue();\n      } else if (CreateOpts.Progress.class.isInstance(iOpt)) {\n        if (progress != null) {\n          throw new HadoopIllegalArgumentException(\n              \"Progress option is set multiple times\");\n        }\n        progress = ((CreateOpts.Progress) iOpt).getValue();\n      } else if (CreateOpts.CreateParent.class.isInstance(iOpt)) {\n        if (createParent != null) {\n          throw new HadoopIllegalArgumentException(","sourceCodeStart":554,"sourceCodeEnd":590,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/AbstractFileSystem.java#L554-L590","documentation":"AbstractFileSystem.create accepts CreateOpts.ChecksumParam at most once; a second occurrence throws HadoopIllegalArgumentException (the message text says \"CreateChecksumType\", the legacy option name). ChecksumParam carries the checksum type/bytes pair, so duplicates are rejected before the merged checksum option is computed.","triggerScenarios":"Two CreateOpts.checksumParam(...) entries in one create() call, typically a caller's tuning option plus a framework default appended afterwards.","commonSituations":"Checksum-type tuning (CRC32 vs CRC32C) applied both by config-derived code and by the caller; option merge helpers that append instead of replace; legacy code still naming the option \"CreateChecksumType\".","solutions":["Pass CreateOpts.checksumParam(...) once only","Use CreateOpts.setOpt(CreateOpts.checksumParam(opt), opts) to replace an existing one","Dedupe opts by class in shared wrappers"],"exampleFix":"// before\nfc.create(f, flag, CreateOpts.checksumParam(new ChecksumOpt(ChecksumType.CRC32C, 512)),\n    CreateOpts.checksumParam(new ChecksumOpt(ChecksumType.CRC32, 512)));\n\n// after\nfc.create(f, flag, CreateOpts.checksumParam(new ChecksumOpt(ChecksumType.CRC32C, 512)));","handlingStrategy":"validation","validationCode":"opts = CreateOpts.setOpt(CreateOpts.checksumParam(cOpt), opts); // replaces existing ChecksumParam","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set the checksum type/bytes via a single ChecksumParam option","Use CreateOpts.setOpt instead of appending when overriding","Dedupe opts by class in shared create wrappers"],"tags":["hadoop","file-create","options","checksum","varargs"],"backgroundTag":"duplicate-create-option","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}