I came across this issue when trying to add a role to my own user, in order to have the account serve as a community account for community user provisioning. I also tried creating another admin with the role set from the get-go but same issue. Anybody else seen this?

enter image description here

  • Created a custom Role and all fixed, go figure Dec 18, 2019 at 22:53

1 Answer 1


This is a pretty common issue with scratch orgs, particularly if your org is generated with hasSampleData: false. It comes up any time you assign one of the built-in Roles to any User and it's always a gack.

I typically begin scratch org builds that use hasSampleData: false with a little Anonymous Apex:

delete [SELECT Id FROM UserRole];
UserRole ur = new UserRole(Name = 'CEO');
insert ur;
update new User(Id = UserInfo.getUserId(), UserRoleId = ur.Id);
  • 3
    It appears this error message has changed but the resolution is the same. I'm getting: "The data you were trying to access could not be found" Mar 30, 2023 at 19:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .