Permission denied to edit Permission Rules


When I enter a custom doctype and I make changes to the Permission Rules table, I am faced with the following error when I try to save. I am currently logged in as the Administrator. Kindly assist how I could rectify this error. Thank you.

Traceback (most recent call last):
  File "/home/frappe/benches/demo-erp/apps/frappe/frappe/desk/form/", line 22, in savedocs
  File "/home/frappe/benches/demo-erp/apps/frappe/frappe/model/", line 242, in save
    return self._save(*args, **kwargs)
  File "/home/frappe/benches/demo-erp/apps/frappe/frappe/model/", line 286, in _save
  File "/home/frappe/benches/demo-erp/apps/frappe/frappe/model/", line 728, in run_post_save_methods
  File "/home/frappe/benches/demo-erp/apps/frappe/frappe/model/", line 661, in run_method
    return Document.hook(fn)(self, *args, **kwargs)
  File "/home/frappe/benches/demo-erp/apps/frappe/frappe/model/", line 839, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/frappe/benches/demo-erp/apps/frappe/frappe/model/", line 822, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/frappe/benches/demo-erp/apps/frappe/frappe/model/", line 655, in 
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/frappe/benches/demo-erp/apps/frappe/frappe/core/doctype/doctype/", line 143, in on_update
  File "/home/frappe/benches/demo-erp/apps/frappe/frappe/core/doctype/doctype/", line 209, in export_doc
  File "/home/frappe/benches/demo-erp/apps/frappe/frappe/modules/", line 22, in export_to_files
    write_document_file(frappe.get_doc(record[0], record[1]), record_module, create_init=create_init)
  File "/home/frappe/benches/demo-erp/apps/frappe/frappe/modules/", line 43, in write_document_file
    with open(os.path.join(folder, fname +".json"),'w+') as txtfile:
IOError: [Errno 13] Permission denied: u'/home/frappe/benches/demo-erp/apps/hr_custom/hr_custom/hr_custom/doctype/cpf_aw_ceiling/cpf_aw_ceiling.json'

Have you added a role to your custom doc type?(Set up> Doc type)

Hi @Pawan,

Yes, we do have a role currently in there. But what we are trying to achieve is to add another role (System Manager) and remove this one :

Hi @Pawan,

Would like to follow up on this Permission issue. Still unable to delete the role and add a new role, with the same issue highlighted above. We are in Developer mode. Is there any other permission that needs to be modified?

Thank you.

Are you seeing the delete button once you click on the below icon shown in the grid

Hi @Pawan,

Thank you, was able to do it - replaced the role I wanted to delete with HR Manager role. Not sure why but that is one role I was able to replace with, with no error.