octobercms/october · error · Error
Media Manager popup option "alias" is not set.
Error message
Media Manager popup option "alias" is not set.
What it means
Front-end Error thrown in mediamanager.popup.js init() when the popup control is instantiated without the 'alias' option. Like the crop popup, this generic media popup needs the server widget alias to route its AJAX requests to the right MediaManager instance; init() throws before any DOM is built, so no popup appears at all.
Source
Thrown at modules/media/widgets/mediamanager/assets/js/mediamanager.popup.js:35
this.$popupElement = null;
this.options = { ...MediaManagerPopup.DEFAULTS, ...options };
this.init();
this.show();
}
dispose() {
this.unregisterHandlers();
this.$popupRootElement.remove();
this.$popupRootElement = null;
this.$popupElement = null;
}
init() {
if (this.options.alias === undefined) {
throw new Error('Media Manager popup option "alias" is not set.');
}
this.$popupRootElement = $('<div/>');
this.registerHandlers();
}
registerHandlers() {
this.$popupRootElement.one('hide.oc.popup', this.onPopupHidden);
this.$popupRootElement.one('shown.oc.popup', this.onPopupShown);
}
unregisterHandlers() {
this.$popupElement.off('popupcommand', this.onPopupCommand);
this.$popupRootElement.off('popupcommand', this.onPopupCommand);
}
show() {
const data = {View on GitHub (pinned to b608633a7e)
Solutions
- Include alias in the popup options, set to the alias of the MediaManager widget rendered by the server (inspect the widget's root element data attributes or the PHP config passed to the partial).
- Prefer triggering the existing media finder/picker wiring rather than instantiating the popup directly.
- Add a defensive check for options.alias before init and log a clear message pointing at the missing option.
Example fix
// before
new $.oc.mediaManager.popup({
onClick: function ($image) { /* ... */ }
});
// after
new $.oc.mediaManager.popup({
alias: 'mediamanager', // the server-side widget alias
onClick: function ($image) { /* ... */ }
}); Defensive patterns
Strategy: validation
Validate before calling
if (!options || options.alias === undefined) {
throw new Error('mediaManager popup requires options.alias');
}
new $.oc.mediaManager.popup(options); Type guard
function hasPopupAlias(o) {
return !!o && typeof o.alias === 'string' && o.alias.length > 0;
} Prevention
- Pass the widget alias rendered by the server whenever opening the media picker from custom JS.
- Log a descriptive error when alias is missing instead of letting init() throw deep in the widget.
- Keep custom form-widget JS in sync with the media manager's option contract after upgrades.
When it happens
Trigger: Calling new $.oc.mediaManager.popup(...) (or the equivalent factory) with options that omit alias — typically from a custom form widget or a plugin's own JS that opens the media picker without copying the alias out of the server-rendered data attributes.
Common situations: Third-party form widgets that embed the media picker manually; refactored JS that constructs options from scratch after an upgrade changed the expected fields; copy-pasted popup code from tutorials that predates the alias requirement.
Related errors
- Media Manager image crop popup option "alias" is not set.
- A row is not found for the updated data
- Trying to get selected row without a popup reference.
- command option is not set for toolbar button
- command option is not set for menu item
AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21).
Data as JSON: /api/errors/3861e50518eaa827.
Report an issue: GitHub.