Misleading Error Message and Logging Issue in Bulk Import #11445

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

Originally created by @moises-perez-tfs on GitHub (Aug 2, 2025).

Originally assigned to: @jnovinger on GitHub.

Deployment Type

Self-hosted

NetBox Version

v4.2.9

Python Version

3.12

Steps to Reproduce

  1. Attempt to import a CSV file with duplicate entries (with the same ID) for DCIM Devices.
  2. Observe the error message displayed in the UI.
  3. Check the logs with DEBUG logging disabled.

Expected Behavior

  • The error message should accurately reflect the cause of the error, indicating that there are duplicate entries in the CSV file.
  • The error should be logged even when DEBUG logging is disabled, to ensure proper tracking and diagnosis.

Observed Behavior

We encountered an issue related to the Operation failed due to object-level permissions violation error message during a bulk import operation. There are a couple of problems that I would like to report:

  • Misleading Error Message: The error message Operation failed due to object-level permissions violation is misleading. The error occurs because of a check to verify that the number of objects intended to be updated matches the number updated in the database. This error is raised if any of the items in the CSV file to be imported are repeated. The actual issue is related to duplicate entries in the CSV file, not object-level permissions.
  • Logging Issue: Errors like this are only logged if DEBUG logging is enabled. Otherwise, they only appear momentarily in the UI. This results in no record of the error in the logs, as we typically log error-level messages in production. This makes it difficult to track and diagnose such issues.
Image

This line seems to be the issue: e5cdd8f2b0/netbox/netbox/views/generic/bulk_views.py (L506)

Originally created by @moises-perez-tfs on GitHub (Aug 2, 2025). Originally assigned to: @jnovinger on GitHub. ### Deployment Type Self-hosted ### NetBox Version v4.2.9 ### Python Version 3.12 ### Steps to Reproduce 1. Attempt to import a CSV file with duplicate entries (with the same ID) for DCIM Devices. 2. Observe the error message displayed in the UI. 3. Check the logs with DEBUG logging disabled. ### Expected Behavior - The error message should accurately reflect the cause of the error, indicating that there are duplicate entries in the CSV file. - The error should be logged even when DEBUG logging is disabled, to ensure proper tracking and diagnosis. ### Observed Behavior We encountered an issue related to the Operation failed due to object-level permissions violation error message during a bulk import operation. There are a couple of problems that I would like to report: - Misleading Error Message: The error message Operation failed due to object-level permissions violation is misleading. The error occurs because of a check to verify that the number of objects intended to be updated matches the number updated in the database. This error is raised if any of the items in the CSV file to be imported are repeated. The actual issue is related to duplicate entries in the CSV file, not object-level permissions. - Logging Issue: Errors like this are only logged if DEBUG logging is enabled. Otherwise, they only appear momentarily in the UI. This results in no record of the error in the logs, as we typically log error-level messages in production. This makes it difficult to track and diagnose such issues. <img width="385" height="113" alt="Image" src="https://github.com/user-attachments/assets/1b23b4ce-d818-4b61-8e91-07954bc73111" /> This line seems to be the issue: https://github.com/netbox-community/netbox/blob/e5cdd8f2b0273ad3a109b6a88a4d87028660dd53/netbox/netbox/views/generic/bulk_views.py#L506
adam added the type: bugstatus: acceptednetboxseverity: low labels 2025-12-29 21:45:19 +01:00
adam closed this issue 2025-12-29 21:45:19 +01:00
Author
Owner

@jnovinger commented on GitHub (Aug 4, 2025):

@moises-perez-tfs, thank you for reporting this issue with bulk import error messaging. This appears to be a legitimate concern about misleading error messages and logging behavior.

To properly reproduce and verify the issue, we need CSV content that triggers this behavior. Please provide a minimal CSV file with the specific field names and duplicate entries.

@jnovinger commented on GitHub (Aug 4, 2025): @moises-perez-tfs, thank you for reporting this issue with bulk import error messaging. This appears to be a legitimate concern about misleading error messages and logging behavior. To properly reproduce and verify the issue, we need CSV content that triggers this behavior. Please provide a minimal CSV file with the specific field names and duplicate entries.
Author
Owner

@moises-perez-tfs commented on GitHub (Aug 5, 2025):

Hey @jnovinger, the file content doesn't need to be too complex. You can use an existing ID and assign it a role name to replace.

id,role
34808,Switch (Access)
34808,Switch (Access)

You can replace 34808 for an existing device ID in your Netbox instance.

@moises-perez-tfs commented on GitHub (Aug 5, 2025): Hey @jnovinger, the file content doesn't need to be too complex. You can use an existing ID and assign it a role name to replace. ```csv id,role 34808,Switch (Access) 34808,Switch (Access) ``` You can replace `34808` for an existing device ID in your Netbox instance.
Author
Owner

@github-actions[bot] commented on GitHub (Aug 12, 2025):

This is a reminder that additional information is needed in order to further triage this issue. If the requested details are not provided, the issue will soon be closed automatically.

@github-actions[bot] commented on GitHub (Aug 12, 2025): This is a reminder that additional information is needed in order to further triage this issue. If the requested details are not provided, the issue will soon be closed automatically.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11445