Skip to content

Multi-edit notification silently fails validation when content exceeds 1024 chars (string_too_long) #1793

Description

@Marvelous2095

Description

When performing a "Multi edit" bulk action on several devices via the web UI, the generated in-app notification summary (listing all affected MAC addresses) can exceed the 1024-character limit enforced by the CreateNotificationRequest Pydantic model. Instead of being truncated, the write is rejected with a validation error and the notification is silently dropped — the underlying device edit itself succeeds, but no record of the bulk action appears in the notification/message center.

Steps to reproduce

  1. Select enough devices (roughly 15+, depending on MAC/name length) in the Devices view.
  2. Perform a "Multi edit" action (e.g. bulk update a field) on all of them at once.
  3. Check the application logs.

Observed log output

[Validation] Error for write_notification: 1 validation error for CreateNotificationRequest
content
  String should have at most 1024 characters [type=string_too_long, input_value='[Multi edit] Executed "u...3:02,9c:8d:7c:30:fc:0d"', input_type=str]
    For further information visit https://errors.pydantic.dev/2.13/v/string_too_long

This occurred twice within a couple of minutes of each other while doing two separate bulk multi-edit actions.

Expected behavior

The notification content should be truncated (e.g. to 1024 chars, with an ellipsis or a summary like "and N more devices") instead of being rejected outright and lost. A failed multi-edit summary notification means there's no audit trail of what was changed in bulk.

Environment

  • Image: ghcr.io/netalertx/netalertx:latest (digest sha256:0ee5cdcaa8a84bfd2f31354b4b30e603804d124821055b9942dcffb52d2ce4bc, pulled ~2 weeks before report)
  • Deployment: Docker (docker compose), Ubuntu host

Suggested fix

Truncate the content field server-side before constructing CreateNotificationRequest (or raise the max_length for this specific notification type / summarize instead of listing every MAC individually) rather than letting Pydantic validation reject the whole write.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Waiting for reply⏳Waiting for the original poster to respond, or discussion in progress.next release/in dev image 🚀This is coming in the next release or was already released if the issue is Closed.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions