{"record":{"id":"4696af2cbf01ed0d","repo":"getredash/redash","slug":"unknown-access-type","errorCode":null,"errorMessage":"Unknown access type.","messagePattern":"Unknown access type\\.","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"redash/handlers/permissions.py","lineNumber":47,"sourceCode":"        result = defaultdict(list)\n\n        for perm in permissions:\n            result[perm.access_type].append(perm.grantee.to_dict())\n\n        return result\n\n    def post(self, object_type, object_id):\n        model = get_model_from_type(object_type)\n        obj = get_object_or_404(model.get_by_id_and_org, object_id, self.current_org)\n\n        require_admin_or_owner(obj.user_id)\n\n        req = request.get_json(True)\n\n        access_type = req[\"access_type\"]\n\n        if access_type not in ACCESS_TYPES:\n            abort(400, message=\"Unknown access type.\")\n\n        try:\n            grantee = User.get_by_id_and_org(req[\"user_id\"], self.current_org)\n        except NoResultFound:\n            abort(400, message=\"User not found.\")\n\n        permission = AccessPermission.grant(obj, access_type, grantee, self.current_user)\n        db.session.commit()\n\n        self.record_event(\n            {\n                \"action\": \"grant_permission\",\n                \"object_id\": object_id,\n                \"object_type\": object_type,\n                \"grantee\": grantee.id,\n                \"access_type\": access_type,\n            }\n        )","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/getredash/redash/blob/ca79fe988d81cdac9675b412f3dfcab107bc1fbc/redash/handlers/permissions.py#L29-L65","documentation":"Raised by PermissionResource.post in redash/handlers/permissions.py when the access_type in the request body is not in the ACCESS_TYPES set (modify being the typical supported type). It guards the generic ACL-granting endpoint used by queries and dashboards.","triggerScenarios":"POST /api/<object_type>/<id>/permissions with {\"access_type\": \"write\"} or any value other than the allowed ones (e.g. 'modify').","commonSituations":"Guessing permission names from other systems ('read'/'write'/'admin') instead of Redash's vocabulary; version drift where the allowed access types changed; typos in automation scripts.","solutions":["Use an allowed access_type — for granting, 'modify' is the supported value in this Redash version.","Inspect ACCESS_TYPES in redash/handlers/permissions.py for your version to confirm the vocabulary.","Check the API response body; the 400 clearly indicates the value was rejected."],"exampleFix":"# before\nclient.post(f'/api/queries/{qid}/permissions', json={'user_id': uid, 'access_type': 'write'})\n\n# after\nclient.post(f'/api/queries/{qid}/permissions', json={'user_id': uid, 'access_type': 'modify'})","handlingStrategy":"validation","validationCode":"ALLOWED = {'modify'}\nif access_type not in ALLOWED:\n    raise ValueError(f'unsupported access_type: {access_type}')","typeGuard":"def is_valid_access_type(value: str) -> bool:\n    return value in {'modify'}","tryCatchPattern":null,"preventionTips":["Read ACCESS_TYPES in your Redash version before scripting permission grants.","Pin your Redash version and review upgrade notes for permission vocabulary changes."],"tags":["redash","permissions","acl","bad-request"],"backgroundTag":"invalid-enum-value","analyzedSha":"ca79fe988d81cdac9675b412f3dfcab107bc1fbc","analyzedAt":"2026-08-28T18:32:34.637Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}