Skip to content

Misleading Error Message and Logging Issue in Bulk Import #20011

@moises-perez-tfs

Description

@moises-perez-tfs

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:

if self.queryset.filter(pk__in=[obj.pk for obj in new_objs]).count() != len(new_objs):

Metadata

Metadata

Assignees

No one assigned

    Labels

    severity: lowDoes not significantly disrupt application functionality, or a workaround is availablestatus: needs ownerThis issue is tentatively accepted pending a volunteer committed to its implementationtype: bugA confirmed report of unexpected behavior in the application

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions