Entity storage should throw an error when attempting to save an entity with a bundle that doesn't exist

Created on 11 August 2012, over 12 years ago
Updated 18 March 2025, 30 days ago

In today's episode of "there's an hour of my life I'll never get back..."

In the Spark installation profile, I attempted to create an "About Us" page in the little demo module that loads as part of the install profile: #1722802: Add an "About us" page Simple enough task, right? BZZT. WRONG. Why?

Because as dman so eloquently lays out:

spark_demo is listed as a requirement for spark : so will run its install before the spark install.
But it's the spark.install that creates a 'page' content type after that.

If I'd gotten an error such as "Invalid node type 'page'" when I called this function, I could maybe have figured this out. But with it silently doing nothing, I was completely at a loss, and dman saved my bacon.

Let's be nicer to people in this situation. :)

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component

base system

Created by

🇨🇦Canada webchick Vancouver 🇨🇦

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇦🇺Australia acbramley

    Surprised to see this is still an issue, and not specific to nodes (tested with block_content as well). Block content will even let you edit the entity, Node throws an error Call to a member function getPreviewMode() on null in Drupal\node\NodeForm->actions()

    We should be able to throw an error at the storage level.

Production build 0.71.5 2024