Skip to content

assign_group_owner fails with ValidationError on lastUpdated field #545

@dtump

Description

@dtump

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • Before submitting, I searched existing issues and pull requests.

Python Version & Okta SDK Version(s)

Python 3.13.12
okta    3.4.2

Affected Class/Method(s)

okta.api.group_owner_api.GroupOwnerApi.assign_group_owner
okta.models.group_owner.GroupOwner.from_dict

Customer Information

Organization Name: Schuberg Philis
Paid Customer: yes

Code Snippet

from okta.client import Client as OktaClient
from okta.models import AssignGroupOwnerRequestBody, GroupOwnerType
import asyncio

client = OktaClient({"orgUrl": org_url, "token": api_token})
body = AssignGroupOwnerRequestBody(id=user_id, type=GroupOwnerType.USER)

# This raises ValidationError, even though the owner IS assigned
result = asyncio.run(client.assign_group_owner(group_id, body))

Debug Output / Traceback

File "okta/api/group_owner_api.py", line 156, in assign_group_owner
    resp = self.response_deserialize(
        response_data=response_data,
        response_types_map=_response_types_map,
    )
File "okta/api_client.py", line 369, in response_deserialize
    return_data = self.deserialize(response_text, response_type)
File "okta/api_client.py", line 448, in deserialize
    return self.__deserialize(data, response_type)
File "okta/api_client.py", line 491, in __deserialize
    return self.__deserialize_model(data, klass)
File "okta/api_client.py", line 828, in __deserialize_model
    return klass.from_dict(data)
File "okta/models/group_owner.py", line 137, in from_dict
    _obj = cls.model_validate(...)
pydantic_core._pydantic_core.ValidationError: 1 validation error for GroupOwner
lastUpdated
  Input should be a valid datetime or date, invalid character in year
  [type=datetime_from_date_parsing, input_value='Mon May 18 07:34:17 UTC 2026', input_type=str]

Expected Behavior

assign_group_owner() should return the GroupOwner object without raising an exception. The lastUpdated field should handle the datetime format that the API actually returns.

Actual Behavior

The API call succeeds (owner is assigned, confirmed via list_group_owners), but the SDK raises a pydantic.ValidationError because the lastUpdated field is returned in a non-ISO format (Mon May 18 07:34:17 UTC 2026) that the GroupOwner model cannot parse.

Steps to reproduce

  1. Call assign_group_owner with a valid group_id and user_id.
  2. The owner is assigned in Okta (verifiable via the admin UI or list_group_owners).
  3. The SDK raises ValidationError during response deserialization.

References

The root cause is that the Okta API returns lastUpdated in EEE MMM dd HH:mm:ss z yyyy format for the GroupOwner response, while the Pydantic model expects ISO 8601. This likely affects list_group_owners as well if any owner has been recently modified.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions