Drupal Autocomplete Patch Rejects Invalid New Tags in Tests
Editors who create new taxonomy tags while saving Drupal articles could encounter stricter validation under a proposed core patch that rejects incomplete referenced entities. Comparative testing by The DropTimes found that the patch prevents invalid tags from being created and blocks the article submission, while existing Drupal 11.4.12 behaviour allows the same incomplete data to be saved. The change is being reviewed under Drupal core issue #2438017; the associated change record is marked Draft and does not confirm inclusion in a stable release.
The DropTimes tested the proposed fix across three environments: Drupal 11.4.12, an unpatched Drupal 11.5.0 development checkout, and the same development version with changes from merge request !17487 applied. The reported results show how the tested patch changes validation for automatically created references, including required fields, custom constraints and entity creation hooks. The underlying reproduction scripts and their execution have not been independently reproduced in this editorial review, and the results do not establish that the fix has been included in an official Drupal release.
How an Invalid Tag Gets Saved
Drupal's entity reference autocomplete fields can be configured to create referenced entities that do not already exist. For example, an article's Tags field can allow editors to enter a new taxonomy term without creating it separately through the taxonomy administration interface.
A problem arises when the target vocabulary contains an additional required field that the autocomplete widget cannot populate. Consider a Tags vocabulary with a required Summary field and no default value. The editor enters a term name, but the autocomplete widget collects only the label, leaving the required Summary empty.
Under the behaviour reproduced in Drupal 11.4.12 and unpatched 11.5.0-dev, the article saves successfully and Drupal creates the taxonomy term despite the missing required value. In the reported patched test, that sequence changes because the newly created term is validated before its reference is accepted.
When the term fails validation, the referencing article cannot be saved through the tested form submission. The change prevents the incomplete term from being persisted through that workflow, but it can also interrupt an editor who cannot see or supply the missing field.
The DropTimes Tests Three Drupal Environments
The DropTimes developed and ran a PHP reproduction script that submits Drupal forms programmatically and records validation errors alongside the resulting database entities. The investigation covered 11 scenarios involving required fields, defaults, existing references, custom constraints, entity hooks, standalone autocomplete elements and programmatic entity validation.
The first test created a new tag named "Brand new tag" in a vocabulary where Summary was required but had no default. Both unpatched environments saved one article and created the term with an empty Summary. With the proposed patch applied, the form reported an error and saved neither the article nor the term.
The second test supplied a valid default value for Summary. All three environments successfully saved the article and new tag. A third test selected an existing, valid term rather than creating a new one. That operation also succeeded across all three environments.
The DropTimes then tested an autocomplete input combining an existing term with a new term that lacked the required Summary. The unpatched environments saved the article and created the incomplete term. The patched environment rejected the article submission and did not create the invalid term. The previously existing term remained unchanged.
Another test introduced a custom validation constraint requiring taxonomy term names to contain at least eight characters. The unpatched environments accepted a shorter name during autocreation. The patched environment rejected it, while a name satisfying the constraint was accepted.
These comparisons show that the patch affects newly created references that fail validation, rather than preventing editors from selecting existing valid references or creating new entities that satisfy their constraints.
Why the Editor May See the Wrong Problem
The proposed implementation produces a generic autocomplete error when a newly created target fails validation. In The DropTimes' missing-Summary test, the patched environment recorded the message: “There are no taxonomy terms matching "Brand new tag".”
The error does not identify the required Summary field or explain that Drupal rejected an invalid new entity. It presents the problem as a failed autocomplete match, even though the entered label was sufficient to initiate creation.
The underlying entity validation can report more specific information. In another test, The DropTimes created a node with an unsaved taxonomy term lacking its required Summary and called $node->validate(). The unpatched environments returned no violations for that condition. The patched version reported a violation associated with the referenced term's missing Summary value.
The distinction has practical consequences for editors and site administrators. An editor encountering the autocomplete error may be unable to resolve it from the article form because the widget provides no control for the additional required field. Correcting the target vocabulary configuration or changing how the entity is created may require a site builder or developer.
The proposed behaviour also reflects a deliberate implementation decision documented in the core issue discussion. Invalid autocreation is reported in the same manner as an unavailable autocomplete match, while detailed violations remain available through entity validation. Whether this gives editors sufficient information remains relevant to the issue's outstanding usability review.
Creation Hooks Produce Different Results
The DropTimes also tested how Drupal behaves when custom code supplies the missing required value during different stages of entity creation.
When a test implementation populated Summary through hook_taxonomy_term_create(), the patched environment accepted the newly created term and saved the article. The term satisfied its required-field constraint when validation occurred.
The result changed when the same field was populated only through hook_entity_presave(). Both unpatched environments saved the article and term, with the Summary value supplied before persistence. The patched environment rejected the submission because validation occurred before the presave hook could populate the missing field.
This difference identifies a potential compatibility issue for custom Drupal implementations. Code that relies on presave hooks to complete automatically created referenced entities may need adjustment if the patch is adopted. Supplying valid defaults or setting required values during entity creation can allow validation to succeed, provided all applicable constraints are satisfied.
Standalone Autocomplete and Entity APIs
The proposed fix extends beyond the autocomplete widget used by entity reference fields. It also affects standalone Form API elements configured to create new referenced entities.
The DropTimes tested a standalone entity_autocomplete element with reference validation enabled and disabled. In the patched environment, enabling #validate_reference prevented an incomplete taxonomy term from being saved. Setting the option to FALSE allowed the custom test form's submit handler to create the incomplete term.
That setting does not make an invalid entity valid. The proposed API documentation states that callers disabling reference validation are responsible for validating extracted references, including newly created targets.
The draft change record also proposes a new required method, FieldableEntityInterface::isValidationRunning(): bool, to identify entities already undergoing validation. This is intended to prevent recursive validation problems when referenced entities point back to one another.
Classes extending ContentEntityBase would inherit the proposed implementation. Custom entity classes implementing FieldableEntityInterface directly, or through another interface without inheriting the implementation, would need to provide the method. Implementations that override entity validation may also need to maintain the validation state correctly.
The Patch Remains Under Review
The underlying Drupal core issue dates to February 2015. Bernd Oliver Sünderhauf, a Drupal contributor known as pancho, reopened development work on the problem in October 2026 and created merge request !17487.
On 14 November 2026, Bernd reported expanded test coverage, changes to standalone autocomplete validation, adjustments to error messages and a draft core change record. An automated commit check subsequently moved the issue back to Needs work. Bernd later reported that the PHPStan findings had been fixed and continuous integration was green, returning the issue to Needs review.
The draft describes issue activity through 14 November 2026. Manual testing and usability review were still identified as outstanding in the material reviewed for this article; their current status should be checked against the live issue before publication. A separate follow-up issue concerns how Drupal records multiple validation errors against the same form element.
Although the draft change record lists Drupal 11.5.0 under its proposed introduction fields, it remains marked Draft and merge request !17487 targets Drupal core's main development branch. That metadata alone does not establish inclusion in Drupal 11.5 or any shipped release. The DropTimes' comparison demonstrates the proposed behaviour when the patch is applied to a development checkout, not functionality established in a shipped Drupal release.
The testing used programmatic submissions through Drupal's Form API and inspected the resulting errors and saved entities. It did not include browser-based testing of the editor interface.
If adopted, the change would require site builders to consider whether automatically created referenced entities can satisfy their required fields and constraints at creation time. Module maintainers would also need to review custom entity implementations, creation hooks and standalone autocomplete handling. The final compatibility requirements will depend on the code accepted into Drupal core and its confirmed release target.
Research and Testing Disclosure
The DropTimes conducted this investigation using AI-assisted technical research and testing. AI tools supported the analysis of Drupal core changes, development of reproduction scripts, and comparison of test results. The investigation covered 11 scenarios across Drupal 11.4.12, an unpatched Drupal 11.5.0 development checkout, and the same development version with the proposed core patch applied. Testing used programmatic Drupal form submissions to record validation errors and saved entities. The findings reflect behaviour observed in these controlled environments and do not establish that the patch has shipped in an official Drupal release. Browser-based testing was not conducted.
References
-
fix: #2438017: Validate entities auto-created by ER (!17487) | GitLab (18 October 2026)


