{"record":{"id":"62a25c40b55c3085","repo":"octobercms/october","slug":"unknown-template-type","errorCode":null,"errorMessage":"Unknown template type.","messagePattern":"Unknown template type\\.","errorType":"exception","errorClass":"SystemException","httpStatus":null,"severity":"error","filePath":"modules/tailor/classes/editorextension/HasExtensionCrud.php","lineNumber":234,"sourceCode":"        }\n\n        return $template;\n    }\n\n    /**\n     * resolveTypeClassName resolves a template type to its class name\n     * @param string $documentType\n     * @return string\n     */\n    private function resolveTypeClassName($documentType)\n    {\n        $types = [\n            EditorExtension::DOCUMENT_TYPE_BLUEPRINT => Blueprint::class,\n            EditorExtension::DOCUMENT_TYPE_THEME_BLUEPRINT => ThemeBlueprint::class\n        ];\n\n        if (!array_key_exists($documentType, $types)) {\n            throw new SystemException(trans('tailor::lang.editor.invalid_type'));\n        }\n\n        return $types[$documentType];\n    }\n\n    /**\n     * makeMetadataForNewTemplate builds meta data for new templates\n     */\n    protected function makeMetadataForNewTemplate(string $documentType): array\n    {\n        return [\n            'mtime' => null,\n            'path' => null,\n            'type' => $documentType,\n            'isNewDocument' => true\n        ];\n    }\n","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/tailor/classes/editorextension/HasExtensionCrud.php#L216-L252","documentation":"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.","triggerScenarios":"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().","commonSituations":"Custom clients/integrations with hand-written type strings; typos; payloads carried over from before the document type names were fixed.","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."],"exampleFix":"// before\n$type = 'theme-blueprint';\n\n// after\n$type = EditorExtension::DOCUMENT_TYPE_THEME_BLUEPRINT; // 'tailor-theme-blueprint'","handlingStrategy":"type-guard","validationCode":"$types = [\n    \\Tailor\\Classes\\EditorExtension::DOCUMENT_TYPE_BLUEPRINT,\n    \\Tailor\\Classes\\EditorExtension::DOCUMENT_TYPE_THEME_BLUEPRINT,\n];\nif (!in_array($documentType, $types, true)) {\n    throw new InvalidArgumentException('Unsupported tailor document type: ' . $documentType);\n}","typeGuard":"function isTailorTemplateType($type): bool\n{\n    return in_array($type, [\n        \\Tailor\\Classes\\EditorExtension::DOCUMENT_TYPE_BLUEPRINT,\n        \\Tailor\\Classes\\EditorExtension::DOCUMENT_TYPE_THEME_BLUEPRINT,\n    ], true);\n}","tryCatchPattern":"try {\n    $class = $this->resolveTypeClassName($documentType);\n} catch (\\SystemException $e) {\n    // unknown template type — reject the request with a 422 instead of a 500\n}","preventionTips":["Whitelist document types at the request boundary of any custom editor-extension handler.","Reference the EditorExtension constants rather than duplicating type strings."],"tags":["tailor","editor-extension","document-type","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}