{"record":{"id":"2225fe98b8dc89d0","repo":"octobercms/october","slug":"document-data-is-not-provided","errorCode":null,"errorMessage":"Document data is not provided","messagePattern":"Document data is not provided","errorType":"exception","errorClass":"SystemException","httpStatus":null,"severity":"error","filePath":"modules/cms/classes/editorextension/HasExtensionCrud.php","lineNumber":39,"sourceCode":"use Cms\\Classes\\ComponentPartial;\nuse Cms\\Classes\\EditorExtension;\nuse October\\Rain\\Halcyon\\Model as HalcyonModel;\nuse October\\Rain\\Router\\Router as RainRouter;\nuse Editor\\Classes\\ApiHelpers;\n\n/**\n * HasExtensionCrud implements CRUD operations for the CMS Editor Extension\n */\ntrait HasExtensionCrud\n{\n    /**\n     * command_onOpenDocument\n     */\n    protected function command_onOpenDocument()\n    {\n        $documentData = post('documentData');\n        if (!is_array($documentData)) {\n            throw new SystemException('Document data is not provided');\n        }\n\n        $key = ApiHelpers::assertGetKey($documentData, 'key');\n        $documentType = ApiHelpers::assertGetKey($documentData, 'type');\n        $this->assertDocumentTypePermissions($documentType);\n\n        $extraData = $this->getRequestExtraData();\n\n        $isResetFromTemplateFileRequest = isset($extraData['resetFromTemplateFile']);\n        if ($isResetFromTemplateFileRequest) {\n            $this->resetFromTemplateFile($documentType, $key);\n        }\n\n        $template = $this->loadTemplate($documentType, $key);\n        if ($documentType === EditorExtension::DOCUMENT_TYPE_LANG) {\n            $templateData = [\n                'content' => $this->mergeLangContentWithDefaultKeys($template)\n            ];","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/cms/classes/editorextension/HasExtensionCrud.php#L21-L57","documentation":"The EditorExtension's onOpenDocument command requires the POST body to carry a documentData array (with at least 'key' and 'type' keys, both enforced afterwards). If post('documentData') is missing or not an array, this SystemException is thrown — an internal API-contract violation rather than an end-user error.","triggerScenarios":"POSTing to the editor extension's openDocument command without a documentData field; sending documentData as a JSON string instead of a parsed array; a request mangled by middleware or a version mismatch between the editor JS bundle and the PHP backend.","commonSituations":"Custom tooling calling editor endpoints directly; Winter core updated but stale cached editor assets still served; debugging requests replayed without the full payload.","solutions":["Send documentData as an array containing at least 'key' (template path) and 'type' (one of page|partial|layout|content|asset|lang)","Use the built-in CMS editor JavaScript rather than hand-crafted requests","After upgrading Winter, clear cached assets (php artisan cache:clear, re-run winter:mirror) so matching editor JS loads"],"exampleFix":"// before\n$.request('onOpenDocument', { data: { type: 'page', key: 'index.htm' } });\n\n// after\n$.request('onOpenDocument', { data: { documentData: { type: 'page', key: 'index.htm' } } });","handlingStrategy":"type-guard","validationCode":"if (!is_array($documentData = request()->input('documentData'))) {\n    // build the payload correctly instead of letting the editor command throw\n    $documentData = ['type' => $type, 'key' => $key];\n}","typeGuard":"function isDocumentData(payload) {\n  return payload != null && typeof payload === 'object' &&\n    typeof payload.type === 'string' && typeof payload.key === 'string' && !Array.isArray(payload);\n}","tryCatchPattern":null,"preventionTips":["Reuse the bundled editor JS for editor commands; do not hand-roll payloads","After upgrading Winter, clear cached assets so the JS/PHP contract matches","Log the full payload when integrating custom editor callers, so shape drift is visible"],"tags":["editor","api-contract","backend","request-payload","cms"],"backgroundTag":"missing-request-payload","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}