{"record":{"id":"3861e50518eaa827","repo":"octobercms/october","slug":"media-manager-popup-option-alias-is-not-set","errorCode":null,"errorMessage":"Media Manager popup option \"alias\" is not set.","messagePattern":"Media Manager popup option \"alias\" is not set\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"modules/media/widgets/mediamanager/assets/js/mediamanager.popup.js","lineNumber":35,"sourceCode":"        this.$popupElement = null;\n\n        this.options = { ...MediaManagerPopup.DEFAULTS, ...options };\n\n        this.init();\n        this.show();\n    }\n\n    dispose() {\n        this.unregisterHandlers();\n\n        this.$popupRootElement.remove();\n        this.$popupRootElement = null;\n        this.$popupElement = null;\n    }\n\n    init() {\n        if (this.options.alias === undefined) {\n            throw new Error('Media Manager popup option \"alias\" is not set.');\n        }\n\n        this.$popupRootElement = $('<div/>');\n        this.registerHandlers();\n    }\n\n    registerHandlers() {\n        this.$popupRootElement.one('hide.oc.popup', this.onPopupHidden);\n        this.$popupRootElement.one('shown.oc.popup', this.onPopupShown);\n    }\n\n    unregisterHandlers() {\n        this.$popupElement.off('popupcommand', this.onPopupCommand);\n        this.$popupRootElement.off('popupcommand', this.onPopupCommand);\n    }\n\n    show() {\n        const data = {","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/media/widgets/mediamanager/assets/js/mediamanager.popup.js#L17-L53","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nnew $.oc.mediaManager.popup({\n    onClick: function ($image) { /* ... */ }\n});\n\n// after\nnew $.oc.mediaManager.popup({\n    alias: 'mediamanager', // the server-side widget alias\n    onClick: function ($image) { /* ... */ }\n});","handlingStrategy":"validation","validationCode":"if (!options || options.alias === undefined) {\n    throw new Error('mediaManager popup requires options.alias');\n}\nnew $.oc.mediaManager.popup(options);","typeGuard":"function hasPopupAlias(o) {\n    return !!o && typeof o.alias === 'string' && o.alias.length > 0;\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["media-manager","popup","javascript","widget-options","frontend"],"backgroundTag":"missing-required-option","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}