Microsoft.Health.HealthServiceException: The unique identifier for the person cannot be '00000000-0000-0000-0000-000000000000'.

A few application developers have seen this error message when trying to read data from a HealthVault record using an OfflineConnection.  Here is a code fragment which could generate this error:

OfflineWebApplicationConnection offlineConn = new OfflineWebApplicationConnection(personGuid);
offlineConn.Authenticate();
HealthRecordAccessor accessor = new HealthRecordAccessor(offlineConn, recordGuid);
myName = offlineConn.GetPersonInfo().Name;

My first thought is always "did you remember to set both the RecordId *and* the PersonId when setting up your connection?"  But in the case above both appear to be getting set.  So the most likely cause is an outdated entry in your web.config file which is causing you to point at a different environment than you intended (i.e. HealthVault-PPE instead of production HealthVault).  So the guid pair that you're requesting doesn't exist ... and you can't possibly be authorized for a non-existent guid pair.

Check out this excerpt from the How-To article on Offline Access,

“The Authenticate() method authenticates only the application, not the user. So if you send an incorrect UserID (or a RecordID instead of a UserID), you don't see an error message until you actually try to read data.”

So you thought that your call to Authenticate() succeeded in authenticating your {RecordId, PersonId} pair but in reality all that got authenticated was your application itself (via the HealthVault asymmetric key infrastructure).  When the GetPersonInfo() call was made and the record authentication failed, HealthVault sets your PersonId to all zeroes and returns the message above rather than saying "Access Denied."

We continually strive to make our platform error messages more clear ... but we can update this blog a lot faster than we can ship new code.

Comments