{"record":{"id":"d47c9e17c8a0dec6","repo":"WordPress/WordPress","slug":"expected-setting-to-exist-oldcustomizeid","errorCode":null,"errorMessage":"Expected setting to exist:  + oldCustomizeId","messagePattern":"Expected setting to exist:  \\+ oldCustomizeId","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"wp-admin/js/customize-nav-menus.js","lineNumber":3285,"sourceCode":"\t * @param {Array} data.nav_menu_updates\n\t * @param {Array} data.nav_menu_item_updates\n\t */\n\tapi.Menus.applySavedData = function( data ) {\n\n\t\tvar insertedMenuIdMapping = {}, insertedMenuItemIdMapping = {};\n\n\t\t_( data.nav_menu_updates ).each(function( update ) {\n\t\t\tvar oldCustomizeId, newCustomizeId, customizeId, oldSetting, newSetting, setting, settingValue, oldSection, newSection, wasSaved, widgetTemplate, navMenuCount, shouldExpandNewSection;\n\t\t\tif ( 'inserted' === update.status ) {\n\t\t\t\tif ( ! update.previous_term_id ) {\n\t\t\t\t\tthrow new Error( 'Expected previous_term_id' );\n\t\t\t\t}\n\t\t\t\tif ( ! update.term_id ) {\n\t\t\t\t\tthrow new Error( 'Expected term_id' );\n\t\t\t\t}\n\t\t\t\toldCustomizeId = 'nav_menu[' + String( update.previous_term_id ) + ']';\n\t\t\t\tif ( ! api.has( oldCustomizeId ) ) {\n\t\t\t\t\tthrow new Error( 'Expected setting to exist: ' + oldCustomizeId );\n\t\t\t\t}\n\t\t\t\toldSetting = api( oldCustomizeId );\n\t\t\t\tif ( ! api.section.has( oldCustomizeId ) ) {\n\t\t\t\t\tthrow new Error( 'Expected control to exist: ' + oldCustomizeId );\n\t\t\t\t}\n\t\t\t\toldSection = api.section( oldCustomizeId );\n\n\t\t\t\tsettingValue = oldSetting.get();\n\t\t\t\tif ( ! settingValue ) {\n\t\t\t\t\tthrow new Error( 'Did not expect setting to be empty (deleted).' );\n\t\t\t\t}\n\t\t\t\tsettingValue = $.extend( _.clone( settingValue ), update.saved_value );\n\n\t\t\t\tinsertedMenuIdMapping[ update.previous_term_id ] = update.term_id;\n\t\t\t\tnewCustomizeId = 'nav_menu[' + String( update.term_id ) + ']';\n\t\t\t\tnewSetting = api.create( newCustomizeId, newCustomizeId, settingValue, {\n\t\t\t\t\ttype: 'nav_menu',\n\t\t\t\t\ttransport: api.Menus.data.settingTransport,","sourceCodeStart":3267,"sourceCodeEnd":3303,"githubUrl":"https://github.com/WordPress/WordPress/blob/f37eb7ab386ba0785b153f64c9c4451a8df9d9e3/wp-admin/js/customize-nav-menus.js#L3267-L3303","documentation":"Error \"Expected setting to exist:  + oldCustomizeId\" thrown in WordPress/WordPress.","triggerScenarios":"Thrown at wp-admin/js/customize-nav-menus.js:3285 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f37eb7ab386ba0785b153f64c9c4451a8df9d9e3","analyzedAt":"2026-08-17T02:58:14.809Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}