A recent support incident had some failures when trying to add extra tasks through the PSI, but only to certain projects. The exception was thrown from Project.QueueAddToProject method and was:
Microsoft.Office.Project.Server.Errors.InconsistentInternalStateException: Error in the application. at Microsoft.Office.Project.Server.Errors.PSError.FailIfFalseTag(ULSTagID ulsID, ULSCat catID, Boolean testCase) at Microsoft.Office.Project.Server.BusinessLayer.CustomFields.Validate(DataTable customFieldsTable, String entityPrimaryKeyName, DataTable parentTable, Guid entityTypeUid, Guid projectUid, Boolean deleteCFValuesOnModify, Boolean fromWinProj) at ...
It went on a bit longer. but the key point to note was Custom Fields. This was the thing to look for when comparing the projects that failed to those that were working - and the problem obviously wasn't in the data actually being added - but in the project itself that was having data added to.
It was found that the failing projects were ones that had values set forthe project level local custom field Number4 which also had a custom name. Removal of values from this field allowed the QueueAddToProject to proceed without any problems.
Not sure exactly why data in this field had such an affect - but wanted to use this example to highlight a couple of things:
1. The problem may not be in the data you are trying to add when a QueueAddToProject fails
2. The error message can give clues to the location of bad stuff - in this case custom fields - to help in the battle to narrow down what is different for working and failing projects.
So all projects need to be cleaned up to remove data from this project level field. Anyone got a good VBA macro sitting around that might help?