Exception on object change | '"ObjectChange.user" must be a "User" instance.' and incorrect changelog entries #4757

Closed
opened 2025-12-29 19:20:09 +01:00 by adam · 3 comments
Owner

Originally created by @timber-schroeder on GitHub (Apr 13, 2021).

NetBox version

2.10.5

Python version

3.6

Steps to Reproduce

Unfortunately there are no exact steps to reproduce as this appears to be a race condition.

I see this bug occasionally when doing the following at the same time:
1: Modifying many objects, primarily interfaces, (not bulk) via a single API user (svc_live-import)
2: Refreshing the homepage of Netbox as a normal user repeatedly (my personal user)

Expected Behavior

For there not to be 500 errors and incorrect changelog entries.

Observed Behavior

From the API user's perspective using pynetbox:

The request failed with code 500 Internal Server Error: {'error': 'Cannot assign "<SimpleLazyObject: <django.contrib.auth.models.AnonymousUser object at 0x7f3cef4c10b8>>": "ObjectChange.user" must be a "User" instance.', 'exception': 'ValueError', 'netbox_version': '2.10.5', 'python_version': '3.6.8'}, trace:
Traceback (most recent call last):
<snip (internal programs and pynetbox)>
pynetbox.core.query.RequestError: The request failed with code 500 Internal Server Error: {'error': 'Cannot assign "<SimpleLazyObject: <django.contrib.auth.models.AnonymousUser object at 0x7f3cef4c10b8>>": "ObjectChange.user" must be a "User" instance.', 'exception': 'ValueError', 'netbox_version': '2.10.5', 'python_version': '3.6.8'}

From the normal user's perspective and the changelog:
No errors, however the user refreshing the page will sometimes appear as the person that initiated a change that the API user was actually doing, even though the user refreshing the homepage was not making any changes.

This is extremely similar to #3622 however that issue is locked so I cannot comment or reopen it.

I also see 500s when only the API user is in play (and modifying many discrete objects), the human user refreshing the homepage just makes it more obvious the bug is happening due to the changelog mixups.

Originally created by @timber-schroeder on GitHub (Apr 13, 2021). ### NetBox version 2.10.5 ### Python version 3.6 ### Steps to Reproduce Unfortunately there are no exact steps to reproduce as this appears to be a race condition. I see this bug occasionally when doing the following at the same time: 1: Modifying many objects, primarily interfaces, (not bulk) via a single API user (`svc_live-import`) 2: Refreshing the homepage of Netbox as a normal user repeatedly (my personal user) ### Expected Behavior For there not to be 500 errors and incorrect changelog entries. ### Observed Behavior From the API user's perspective using pynetbox: ``` The request failed with code 500 Internal Server Error: {'error': 'Cannot assign "<SimpleLazyObject: <django.contrib.auth.models.AnonymousUser object at 0x7f3cef4c10b8>>": "ObjectChange.user" must be a "User" instance.', 'exception': 'ValueError', 'netbox_version': '2.10.5', 'python_version': '3.6.8'}, trace: Traceback (most recent call last): <snip (internal programs and pynetbox)> pynetbox.core.query.RequestError: The request failed with code 500 Internal Server Error: {'error': 'Cannot assign "<SimpleLazyObject: <django.contrib.auth.models.AnonymousUser object at 0x7f3cef4c10b8>>": "ObjectChange.user" must be a "User" instance.', 'exception': 'ValueError', 'netbox_version': '2.10.5', 'python_version': '3.6.8'} ``` From the normal user's perspective and the changelog: No errors, however the user refreshing the page will sometimes appear as the person that initiated a change that the API user was actually doing, even though the user refreshing the homepage was not making any changes. This is extremely similar to [#3622](https://github.com/netbox-community/netbox/issues/3622) however that issue is locked so I cannot comment or reopen it. I also see 500s when only the API user is in play (and modifying many discrete objects), the human user refreshing the homepage just makes it more obvious the bug is happening due to the changelog mixups.
adam added the type: bugstatus: needs ownerpending closure labels 2025-12-29 19:20:09 +01:00
adam closed this issue 2025-12-29 19:20:10 +01:00
Author
Owner

@github-actions[bot] commented on GitHub (Jun 27, 2021):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our contributing guide.

@github-actions[bot] commented on GitHub (Jun 27, 2021): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Author
Owner

@github-actions[bot] commented on GitHub (Jul 27, 2021):

This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.

@github-actions[bot] commented on GitHub (Jul 27, 2021): This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.
Author
Owner

@karlism commented on GitHub (Aug 27, 2021):

I'm also seeing this error occasionally in our environment, currently with NetBox version 2.11.12

@karlism commented on GitHub (Aug 27, 2021): I'm also seeing this error occasionally in our environment, currently with NetBox version 2.11.12
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4757