octobercms/october · error · SystemException
Unknown template type.
Error message
Unknown template type.
What it means
resolveTypeClassName() only knows two document types — DOCUMENT_TYPE_BLUEPRINT ('tailor-blueprint', mapping to Blueprint) and DOCUMENT_TYPE_THEME_BLUEPRINT ('tailor-theme-blueprint', mapping to ThemeBlueprint). Any other value throws SystemException with the tailor::lang.editor.invalid_type message before template loading begins.
Source
Thrown at modules/tailor/classes/editorextension/HasExtensionCrud.php:234
}
return $template;
}
/**
* resolveTypeClassName resolves a template type to its class name
* @param string $documentType
* @return string
*/
private function resolveTypeClassName($documentType)
{
$types = [
EditorExtension::DOCUMENT_TYPE_BLUEPRINT => Blueprint::class,
EditorExtension::DOCUMENT_TYPE_THEME_BLUEPRINT => ThemeBlueprint::class
];
if (!array_key_exists($documentType, $types)) {
throw new SystemException(trans('tailor::lang.editor.invalid_type'));
}
return $types[$documentType];
}
/**
* makeMetadataForNewTemplate builds meta data for new templates
*/
protected function makeMetadataForNewTemplate(string $documentType): array
{
return [
'mtime' => null,
'path' => null,
'type' => $documentType,
'isNewDocument' => true
];
}
View on GitHub (pinned to b608633a7e)
Solutions
- Send the exact value: 'tailor-blueprint' or 'tailor-theme-blueprint' (prefer the EditorExtension constants in PHP).
- Validate `type` against EditorExtension::DOCUMENT_TYPE_* constants at the request boundary before invoking template CRUD.
Example fix
// before $type = 'theme-blueprint'; // after $type = EditorExtension::DOCUMENT_TYPE_THEME_BLUEPRINT; // 'tailor-theme-blueprint'
Defensive patterns
Strategy: type-guard
Validate before calling
$types = [
\Tailor\Classes\EditorExtension::DOCUMENT_TYPE_BLUEPRINT,
\Tailor\Classes\EditorExtension::DOCUMENT_TYPE_THEME_BLUEPRINT,
];
if (!in_array($documentType, $types, true)) {
throw new InvalidArgumentException('Unsupported tailor document type: ' . $documentType);
} Type guard
function isTailorTemplateType($type): bool
{
return in_array($type, [
\Tailor\Classes\EditorExtension::DOCUMENT_TYPE_BLUEPRINT,
\Tailor\Classes\EditorExtension::DOCUMENT_TYPE_THEME_BLUEPRINT,
], true);
} Try / catch
try {
$class = $this->resolveTypeClassName($documentType);
} catch (\SystemException $e) {
// unknown template type — reject the request with a 422 instead of a 500
} Prevention
- Whitelist document types at the request boundary of any custom editor-extension handler.
- Reference the EditorExtension constants rather than duplicating type strings.
When it happens
Trigger: Any editor extension CRUD command (open, save, new document) receives a documentData.type like 'blueprint', 'theme-blueprint' or 'mixin' instead of the two exact tailor values, and reaches resolveTypeClassName().
Common situations: Custom clients/integrations with hand-written type strings; typos; payloads carried over from before the document type names were fixed.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Document type name is not defined: %s
- Unknown document type: %s
- cms::lang.template.invalid_type
- Type must be one of: {$typeAsString}.
- Invalid field name: {$fieldName}.
AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21).
Data as JSON: /api/errors/62a25c40b55c3085.
Report an issue: GitHub.