{"record":{"id":"ae9097016ebec208","repo":"apache/hadoop","slug":"no-permission-supplied","errorCode":null,"errorMessage":"no permission supplied","messagePattern":"no permission supplied","errorType":"validation","errorClass":"HadoopIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/AbstractFileSystem.java","lineNumber":600,"sourceCode":"      } 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\n    // Create a checksum option honoring user input as much as possible.\n    // If bytesPerChecksum is specified, it will override the one set in\n    // checksumOpt. Any missing value will be filled in using the default.\n    ChecksumOpt defaultOpt = new ChecksumOpt(\n        ssDef.getChecksumType(),","sourceCodeStart":582,"sourceCodeEnd":618,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/AbstractFileSystem.java#L582-L618","documentation":"After scanning the options, AbstractFileSystem.create requires a permission entry; none found throws HadoopIllegalArgumentException(\"no permission supplied\"). FileContext.create injects a default (file default permission with umask applied) via CreateOpts.setOpt (FileContext.java:688-698), so this only bites code calling AbstractFileSystem.create directly without a CreateOpts.Perms option.","triggerScenarios":"Direct afs.create(path, EnumSet.of(CreateFlag.CREATE), opts...) with no CreateOpts.perms(...) in opts — typically custom frameworks or test harnesses that wrap AbstractFileSystem instead of FileContext.","commonSituations":"Porting code from the FileSystem API (which has permission defaulting) straight to AbstractFileSystem; hand-rolled FileContext replacements that forward raw option arrays.","solutions":["Always include CreateOpts.perms(FsPermission.getFileDefault()) when calling AbstractFileSystem.create directly","Prefer FileContext.create, which injects and umask-applies the permission for you","In shared wrappers, add the default via CreateOpts.setOpt so it also de-duplicates"],"exampleFix":"// before\nafs.create(f, EnumSet.of(CreateFlag.CREATE)); // no permission supplied\n\n// after\nafs.create(f, EnumSet.of(CreateFlag.CREATE),\n    CreateOpts.perms(FsPermission.getFileDefault()));","handlingStrategy":"validation","validationCode":"if (CreateOpts.getOpt(CreateOpts.Perms.class, opts) == null) {\n  opts = CreateOpts.setOpt(CreateOpts.perms(FsPermission.getFileDefault()), opts);\n}\nafs.create(f, flag, opts);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always supply CreateOpts.perms when calling AbstractFileSystem.create directly","Route user code through FileContext.create, which injects the default permission with umask","Wrap direct AFS usage in helpers that guarantee the required option set"],"tags":["hadoop","file-create","permissions","options","validation"],"backgroundTag":"missing-required-create-option","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}