{"record":{"id":"1487bcb1c830834e","repo":"apache/hadoop","slug":"unkown-createopts-of-type-iopt-getclass-getname","errorCode":null,"errorMessage":"Unkown CreateOpts of type {iOpt.getClass().getName()}","messagePattern":"Unkown CreateOpts of type (.+?)","errorType":"validation","errorClass":"HadoopIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/AbstractFileSystem.java","lineNumber":595,"sourceCode":"        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(\n              \"CreateParent option is set multiple times\");\n        }\n        createParent = ((CreateOpts.CreateParent) iOpt).getValue();\n      } else {\n        throw new HadoopIllegalArgumentException(\"Unkown CreateOpts of type \" +\n            iOpt.getClass().getName());\n      }\n    }\n    if (permission == null) {\n      throw new HadoopIllegalArgumentException(\"no permission supplied\");\n    }\n\n\n    FsServerDefaults ssDef = getServerDefaults(f);\n    if (ssDef.getBlockSize() % ssDef.getBytesPerChecksum() != 0) {\n      throw new IOException(\"Internal error: default blockSize is\" + \n          \" not a multiple of default bytesPerChecksum \");\n    }\n    \n    if (blockSize == -1) {\n      blockSize = ssDef.getBlockSize();\n    }\n","sourceCodeStart":577,"sourceCodeEnd":613,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/AbstractFileSystem.java#L577-L613","documentation":"The option-scanning loop in AbstractFileSystem.create only recognizes the eight built-in CreateOpts types (BlockSize, BufferSize, ReplicationFactor, BytesPerChecksum, ChecksumParam, Perms, Progress, CreateParent); any other CreateOpts instance falls to the else-branch and throws HadoopIllegalArgumentException(\"Unkown CreateOpts of type ...\") — the typo \"Unkown\" is in the source. Custom CreateOpts subclasses are therefore not a supported extension point here.","triggerScenarios":"Defining your own class extending Options.CreateOpts and passing it into AbstractFileSystem.create or FileContext.create; a newer/other jar on the classpath injecting an option class this version's loop has no branch for.","commonSituations":"Custom filesystem frameworks trying to piggyback extra parameters on CreateOpts; version-skewed hadoop jars on a client classpath; copy of an option class under a different package name.","solutions":["Remove the custom CreateOpts and convey the setting via Configuration keys or FSDataOutputStreamBuilder instead","If your own AbstractFileSystem needs extra create parameters, add them to your createInternal signature/your own API rather than the shared opts varargs","Align hadoop module versions on the classpath so option classes match the loop in use"],"exampleFix":"// before\nclass MyOpt extends Options.CreateOpts { ... }\nfc.create(f, flag, CreateOpts.perms(perm), new MyOpt()); // Unkown CreateOpts of type ...\n\n// after\nconf.setBoolean(\"myfs.create.fast\", true);\nfc = FileContext.getFileContext(myFsUri, conf);\nfc.create(f, flag, CreateOpts.perms(perm));","handlingStrategy":"try-catch","validationCode":"for (Options.CreateOpts o : opts) {\n  if (!(o instanceof Options.CreateOpts.BlockSize || o instanceof Options.CreateOpts.BufferSize\n      || o instanceof Options.CreateOpts.ReplicationFactor || o instanceof Options.CreateOpts.BytesPerChecksum\n      || o instanceof Options.CreateOpts.ChecksumParam || o instanceof Options.CreateOpts.Perms\n      || o instanceof Options.CreateOpts.Progress || o instanceof Options.CreateOpts.CreateParent)) {\n    throw new IllegalArgumentException(\"Unsupported CreateOpts: \" + o.getClass().getName());\n  }\n}","typeGuard":null,"tryCatchPattern":"try { fc.create(f, flag, opts); } catch (HadoopIllegalArgumentException e) { if (e.getMessage().contains(\"CreateOpts of type\")) { /* strip custom opt / fix versions */ } else throw e; }","preventionTips":["Do not subclass Options.CreateOpts to pass extra parameters — use Configuration or FSDataOutputStreamBuilder","Keep hadoop module versions consistent on the classpath","Fail fast on unknown option classes at your own API boundary"],"tags":["hadoop","file-create","options","extension","version-conflict"],"backgroundTag":"unsupported-option-type","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}