octobercms/october · error · SystemException

Missing section definition. Call EntryRecord::inSection() to

Error message

Missing section definition. Call EntryRecord::inSection() to set one.

What it means

Thrown by the getBlueprintDefinition() method on entry records (HasEntryBlueprint trait) when the model instance has no blueprint_uuid attribute set. Every Tailor entry must belong to a section; the UUID is normally assigned when querying via EntryRecord::inSection()/inSectionUuid() or when the record is created through Tailor. Directly instantiating an EntryRecord without a section triggers this SystemException.

Source

Thrown at modules/tailor/models/entryrecord/HasEntryBlueprint.php:50

        });

        $this->bindEvent('model.newInstance', function($model) {
            $model->extendWithBlueprint($this->blueprint_uuid);
        });
    }

    /**
     * getBlueprintDefinition
     */
    public function getBlueprintDefinition(): EntryBlueprint
    {
        if ($this->blueprintCache !== null) {
            return $this->blueprintCache;
        }

        $uuid = $this->blueprint_uuid;
        if (!$uuid) {
            throw new SystemException('Missing section definition. Call EntryRecord::inSection() to set one.');
        }

        $blueprint = BlueprintIndexer::instance()->findSection($uuid);
        if (!$blueprint) {
            throw new SystemException(sprintf('Unable to find section blueprint with ID "%s".', $uuid));
        }

        return $this->blueprintCache = $blueprint;
    }

    /**
     * isEntryStructure
     */
    public function isEntryStructure(): bool
    {
        return $this->getBlueprintDefinition() instanceof StructureBlueprint;
    }

View on GitHub (pinned to b608633a7e)

Solutions

  1. Always obtain models through section APIs: EntryRecord::inSection('handle') for querying, or use the section's newModelInstance() for creating
  2. When creating records programmatically, set the blueprint UUID: $model->blueprint_uuid = $blueprint->uuid before save, or use inSectionUuid to scope the query so the UUID is applied
  3. Fix rows with a null blueprint_uuid in the database by reassigning the correct section UUID
  4. For singular sections, use findSingleForSection() which handles creation for you

Example fix

// before
$record = new \Tailor\Models\EntryRecord;
$record->title = 'Test';
$record->save();  // later blueprint access throws

// after
$blueprint = \Tailor\Classes\BlueprintIndexer::instance()->findSectionByHandle('blog_post');
$record = $blueprint->newModelInstance();
$record->title = 'Test';
$record->save();
Defensive patterns

Strategy: validation

Validate before calling

// Ensure the instance is section-attached before blueprint use
if (empty($model->blueprint_uuid)) {
    $blueprint = \Tailor\Classes\BlueprintIndexer::instance()->findSectionByHandle('blog_post');
    $model->blueprint_uuid = $blueprint->uuid;
}

Type guard

function isSectionAttached(\Tailor\Models\EntryRecord $record): bool
{
    return !empty($record->blueprint_uuid);
}

Prevention

When it happens

Trigger: Doing new EntryRecord or EntryRecord::create([...]) without going through inSection()/inSectionUuid(), or calling blueprint-dependent methods (fieldset, content fields, isEntryStructure) on an unattached instance; also when fetched rows lose their blueprint_uuid (null in the database).

Common situations: Custom code that mass-creates or queries entry records directly instead of using the section-scoped APIs; seeding scripts that insert EntryRecord rows without blueprint_uuid; data corruption after partial imports.

Related errors


AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21). Data as JSON: /api/errors/eb6e88916ecd7d29. Report an issue: GitHub.