{"record":{"id":"6379b5643648ed99","repo":"octobercms/october","slug":"invalid-documentdata-6379b5","errorCode":null,"errorMessage":"Invalid documentData","messagePattern":"Invalid documentData","errorType":"exception","errorClass":"SystemException","httpStatus":null,"severity":"error","filePath":"modules/tailor/classes/editorextension/HasExtensionCrud.php","lineNumber":313,"sourceCode":"     */\n    private function getRequestExtraData()\n    {\n        $extraData = Request::input('extraData');\n        if (!is_array($extraData)) {\n            return [];\n        }\n\n        return $extraData;\n    }\n\n    /**\n     * getRequestDocumentData\n     */\n    private function getRequestDocumentData()\n    {\n        $documentData = Request::input('documentData');\n        if (!is_array($documentData)) {\n            throw new SystemException('Invalid documentData');\n        }\n\n        return $documentData;\n    }\n\n    /**\n     * createTemplate\n     */\n    private function createTemplate($documentType)\n    {\n        $class = $this->resolveTypeClassName($documentType);\n\n        $template = new $class();\n\n        return $template;\n    }\n\n    /**","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/tailor/classes/editorextension/HasExtensionCrud.php#L295-L331","documentation":"getRequestDocumentData() reads `documentData` from the current request and requires an array; commands such as createTemplate depend on it. A missing, null, or string-typed value throws SystemException('Invalid documentData') before any document work starts.","triggerScenarios":"Calling an editor extension AJAX command that internally calls getRequestDocumentData() without a documentData array in the request body, or with documentData encoded as a JSON string.","commonSituations":"Custom clients or tests invoking tailor CRUD handlers; middleware stripping form input; payload shape changes after an October upgrade.","solutions":["Send documentData as an array containing the keys the command needs (at minimum type, often key/title).","Mirror the payload structure the official editor extension client sends.","Verify content-type and form encoding of the AJAX request (form-encoded arrays, not stringified JSON)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"$documentData = \\Request::input('documentData');\nif (!is_array($documentData) || !isset($documentData['type'])) {\n    throw new InvalidArgumentException('documentData array with type is required.');\n}","typeGuard":"function isValidDocumentData($data): bool\n{\n    return is_array($data) && isset($data['type']);\n}","tryCatchPattern":"try {\n    $documentData = $this->getRequestDocumentData();\n} catch (\\SystemException $e) {\n    // malformed request — return a 422 validation error to the client instead of a 500\n}","preventionTips":["Send arrays (form-encoded or properly parsed), never stringified JSON, for documentData.","Mirror the core editor extension client's payload shape in custom integrations."],"tags":["tailor","editor-extension","ajax","request-payload"],"backgroundTag":"missing-request-payload","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}