Invalid Cross Reference Key : Record Type ID value isn’t valid for User: 012v00000008f4nuBB

I am having some issues. The below is a code snipet of my test class. The class complies and produces 96% of coverage with no errors. When deploying in production it throws the above error.

Salesforce says the error is on the first bolded line. However the recordtypeid it throws at me is a recordtype for the second bolded line: which in itself is a legit recordtype.

 User me = TestUtil.createUser();     
        RecordType accountrec = [select id from RecordType where sObjecttype ='Account' and DeveloperName='prop'];
         RecordType opprec = [select id from RecordType where sObjecttype ='Opportunity' and DeveloperName='full'];
         RecordType goalrec = [select id from RecordType where sObjecttype ='Goals__c' and DeveloperName='Manager'];

             Account acc = new Account(, Name='TestAccount');
             insert acc;
             Contact cont = new Contact(FirstName='Test', lastName = 'Contact', phone='(888) 888-8888',;
             insert cont;

             Group__c Group = new Group__c(Name='Group', Ownerid =;
             insert Group; //**ERROR THROWN IS AT THIS LINE**
             Group_Goal__c GroupGoal = new Group_Goal__c(Name ='testGroupgoal',;
             insert GroupGoal;
             Goals__c goal = new Goals__c(, Ownerid =,, Fiscal_Year__c='FY2015');
             insert goal; //**RECORD TYPE PROVIDED IS FOR THIS RECORD** 


Profiles have record type settings. This error means that the user has a profile for which that record type is not enabled. You need to make sure the profile you’re using has access to the desired record type, or that the value is being set in a “without sharing” class.

Source : Link , Question Author : Thomas Riddler , Answer Author : sfdcfox

Leave a Comment