{"record":{"id":"c8b7dfcc2330b7f3","repo":"prestodb/presto","slug":"unknown-accessmode","errorCode":null,"errorMessage":"Unknown AccessMode: ","messagePattern":"Unknown AccessMode: ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/security/CatalogAccessControlRule.java","lineNumber":93,"sourceCode":"        }\n\n        @JsonCreator\n        public static AccessMode fromJson(Object value)\n        {\n            if (Boolean.TRUE.equals(value)) {\n                return ALL;\n            }\n            if (Boolean.FALSE.equals(value)) {\n                return NONE;\n            }\n            if (value instanceof String) {\n                AccessMode accessMode = modeByName.get(((String) value).toLowerCase(Locale.US));\n                if (accessMode != null) {\n                    return accessMode;\n                }\n            }\n\n            throw new IllegalArgumentException(\"Unknown \" + AccessMode.class.getSimpleName() + \": \" + value);\n        }\n\n        boolean implies(AccessMode other)\n        {\n            if (this == ALL && other == READ_ONLY) {\n                return true;\n            }\n            return this == other;\n        }\n    }\n}\n","sourceCodeStart":75,"sourceCodeEnd":105,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/security/CatalogAccessControlRule.java#L75-L105","documentation":"CatalogAccessControlRule.fromJson parses the mode/access-mode field of a catalog access control rule and resolves it against AccessMode by lowercased name. Only the known AccessMode names (ALL, READ_ONLY) are accepted; any other string makes the lookup miss and throws IllegalArgumentException(\"Unknown AccessMode: <value>\").","triggerScenarios":"Loading a catalog access control rules JSON whose rule contains mode or accessMode set to a string that is not a valid AccessMode name (or is null/not a String), e.g. \"read\", \"readonly\", \"ReadWrite\".","commonSituations":"Typo in the rules JSON file; invented mode names like \"read_only\" or \"write\"; hand-edited or migrated rules files; case handled (lowercased before lookup) so only wrong words, not wrong casing, trigger this.","solutions":["Change the rule's mode to exactly \"all\" or \"read_only\" (case-insensitive) in the rules JSON","Re-check the AccessMode enum for the list of supported values in your Presto version","Validate the rules JSON against the expected schema before deploying","If a stricter/other mode is genuinely needed, it must be added to AccessMode upstream"],"exampleFix":"// before (rules.json)\n{ \"catalog\": \"sales\", \"accessMode\": \"read\", \"user\": \"alice\" }\n// after\n{ \"catalog\": \"sales\", \"accessMode\": \"READ_ONLY\", \"user\": \"alice\" }","handlingStrategy":"validation","validationCode":"// validate rules JSON before loading\nSet<String> allowed = Set.of(\"all\", \"read_only\");\nfor (Map<String,Object> rule : rules) {\n    Object mode = rule.get(\"accessMode\");\n    if (mode instanceof String && !allowed.contains(((String) mode).toLowerCase(Locale.US))) {\n        throw new IllegalArgumentException(\"Rule accessMode must be one of \" + allowed + \": \" + mode);\n    }\n}","typeGuard":"boolean isValidAccessMode(Object value) {\n    return value instanceof String\n        && (\"all\".equalsIgnoreCase((String) value) || \"read_only\".equalsIgnoreCase((String) value));\n}","tryCatchPattern":"try {\n    List<CatalogAccessControlRule> parsed = CatalogAccessControlRule.fromJson(rulesJson);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Unknown AccessMode\")) {\n        log.error(\"Rules file has an unsupported access mode; fix the mode value\", e);\n    } else { throw e; }\n}","preventionTips":["Use only \"all\" or \"read_only\" as accessMode values in catalog rules files","Validate rules JSON against a schema at deploy time","Never hand-edit mode strings without checking the AccessMode enum"],"tags":["presto","access-control","json-config","enum-parsing","validation"],"backgroundTag":"unknown-access-mode","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}