octobercms/october · error · SystemException
Mass assignment failed for Model attribute ':attribute'.
Error message
Mass assignment failed for Model attribute ':attribute'.
What it means
Thrown in execAjaxHandlers when the underlying AJAX action fails with a Laravel MassAssignmentException — i.e. an attempt to fill a model attribute that is not mass-assignable (not in the model's $fillable rules). The generic message wraps the original exception; the attribute name is given in the error placeholders. It indicates unsafe attribute injection during an AJAX handler call.
Solutions
- Add the attribute to the model's $fillable array (or remove it from $guarded)
- Explicitly pass only expected keys to the model's fill()/create() call instead of raw post() data
- If the attribute should never be settable, reject or ignore it in the request data before filling
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at modules/backend/classes/Controller.php:549 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21).
Data as JSON: /api/errors/92ac7ee88b9b765f.
Report an issue: GitHub.
Appendix: source
Thrown at modules/backend/classes/Controller.php:549
* if ($componentAlias === $this->getBackendWidgetAlias()) {
* return $this->backendControllerProxy->runAjaxHandler($handler);
* }
* }
* });
*
*/
if ($event = $this->fireSystemEvent('backend.ajax.beforeRunHandler', [$handler])) {
$response = ajax()::wrap($event);
}
else {
$response = $this->callAjaxAction($this->action, $this->params);
}
}
catch (ComponentNotFound $ex) {
throw new SystemException(Lang::get('backend::lang.widget.not_bound', ['name'=>$this->getAjaxRequest()->component]));
}
catch (MassAssignmentException $ex) {
throw new SystemException(Lang::get('backend::lang.model.mass_assignment_failed', ['attribute' => $ex->getMessage()]));
}
catch (HandlerNameInvalid $ex) {
throw new ApplicationException(Lang::get('backend::lang.ajax_handler.invalid_name', ['name'=>$handler]));
}
catch (HandlerNotFound $ex) {
throw new ApplicationException(Lang::get('backend::lang.ajax_handler.not_found', ['name'=>e($handler)]));
}
}
catch (ValidationException $ex) {
Flash::error($ex->getMessage());
$response = ajax()->invalidFields($ex->errors());
}
catch (Throwable $ex) {
report($ex);
$response = ajax()->exception($ex);
}
if ($this->hasAssetsDefined()) {View on GitHub (pinned to b608633a7e)