octobercms/october · error · SystemException
Document data is not provided
Error message
Document data is not provided
What it means
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.
Source
Thrown at modules/cms/classes/editorextension/HasExtensionCrud.php:39
use Cms\Classes\ComponentPartial;
use Cms\Classes\EditorExtension;
use October\Rain\Halcyon\Model as HalcyonModel;
use October\Rain\Router\Router as RainRouter;
use Editor\Classes\ApiHelpers;
/**
* HasExtensionCrud implements CRUD operations for the CMS Editor Extension
*/
trait HasExtensionCrud
{
/**
* command_onOpenDocument
*/
protected function command_onOpenDocument()
{
$documentData = post('documentData');
if (!is_array($documentData)) {
throw new SystemException('Document data is not provided');
}
$key = ApiHelpers::assertGetKey($documentData, 'key');
$documentType = ApiHelpers::assertGetKey($documentData, 'type');
$this->assertDocumentTypePermissions($documentType);
$extraData = $this->getRequestExtraData();
$isResetFromTemplateFileRequest = isset($extraData['resetFromTemplateFile']);
if ($isResetFromTemplateFileRequest) {
$this->resetFromTemplateFile($documentType, $key);
}
$template = $this->loadTemplate($documentType, $key);
if ($documentType === EditorExtension::DOCUMENT_TYPE_LANG) {
$templateData = [
'content' => $this->mergeLangContentWithDefaultKeys($template)
];View on GitHub (pinned to b608633a7e)
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
Example fix
// before
$.request('onOpenDocument', { data: { type: 'page', key: 'index.htm' } });
// after
$.request('onOpenDocument', { data: { documentData: { type: 'page', key: 'index.htm' } } }); Defensive patterns
Strategy: type-guard
Validate before calling
if (!is_array($documentData = request()->input('documentData'))) {
// build the payload correctly instead of letting the editor command throw
$documentData = ['type' => $type, 'key' => $key];
} Type guard
function isDocumentData(payload) {
return payload != null && typeof payload === 'object' &&
typeof payload.type === 'string' && typeof payload.key === 'string' && !Array.isArray(payload);
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Custom tooling calling editor endpoints directly; Winter core updated but stale cached editor assets still served; debugging requests replayed without the full payload.
Related errors
- Invalid documentMetadata
- Component not found
- cms::lang.component.no_records
- cms::lang.component.not_found
- Component does use a default partial
AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21).
Data as JSON: /api/errors/2225fe98b8dc89d0.
Report an issue: GitHub.