Identity Claims resolution failing with string-based User IDs
04:57 11 Jan 2026

I am experiencing a System.FormatException when using GUID-based UserAuthIds in a .NET ServiceStack project. The error seems to be triggered during the internal mapping of the UserAuthId to the .NET ClaimsPrincipal.

The issue is peculiar: it only happens when the authenticated user has no roles or permissions. If at least one role is added to the user, the identity is resolved correctly without errors.

Error: System.FormatException: The input string was not in a correct format.

Observations: It looks like the internal logic that populates ClaimTypes.NameIdentifier is attempting an integer conversion on the User ID string, but only in the code path where the roles collection is empty.

Reproduction:

  • ServiceStack v10.

  • UserAuthId stored as GUID or String.

  • User with no roles assigned in the database.

  • Accessing any route that invokes the ASP.NET Core Authentication middleware.

Expected Behavior: The UserAuthId should always be treated as a string to support GUIDs, regardless of the user roles.

.net servicestack