TypeError: Drupal\ai\OperationType\Chat\ChatMessage::__construct(): Argument #2 ($text) must be of type string, null given

Created on 29 January 2025, 24 days ago

Problem/Motivation

AITextValidation throws error when the field it is validating contains empty string.

Steps to reproduce

- Enable and configure AI Text validation for a node text field
- Let the rule have default values
- Create a new content and leave the text field empty
- Save the content
- You will see this error:

TypeError: Drupal\ai\OperationType\Chat\ChatMessage::__construct(): Argument #2 ($text) must be of type string, null given, called in /var/www/html/web/modules/contrib/ai/modules/ai_validations/src/Plugin/Validation/Constraint/AiTextConstraintValidator.php on line 58 in Drupal\ai\OperationType\Chat\ChatMessage->__construct() (line 47 of modules/contrib/ai/src/OperationType/Chat/ChatMessage.php).

Proposed resolution

NA

Remaining tasks

NA

User interface changes

NA

API changes

NA

Data model changes

NA

🐛 Bug report
Status

Active

Version

1.0

Component

Other Submodules

Created by

🇮🇳India Vivek Panicker Kolkata

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024