This issue occurs if this option Customizing Master Pages and Page Layouts
is disabled !
To check the value of master page customization is allowed on the current site collection try to run the following code
function getMasterPageAccess() {
var clientContext = new SP.ClientContext();
oSite = clientContext.get_site();
clientContext.load(oSite);
clientContext.executeQueryAsync(
Function.createDelegate(this, function() {
var siteInfo = '';
//The below line get the boolean value of master page editing is allowed on this site collection
if (oSite.get_allowMasterPageEditing())
siteInfo = 'MasterPage customization: Allowed';
else
siteInfo = 'MasterPage customization: Not Allowed';
alert(siteInfo.toString());
}),
Function.createDelegate(this, function(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}));
}
function injectMethod() {
getMasterPageAccess();
}
ExecuteOrDelayUntilScriptLoaded(injectMethod, "sp.js");
Code Ref Get Master Page Customization in Browser console
If it's not allowed you can run this code in browser console
function enableMasterPageAccess() {
var clientContext = new SP.ClientContext();
oSite = clientContext.get_site();
//The below line helps to enables the master page access
oSite.set_allowMasterPageEditing(true);
clientContext.load(oSite);
clientContext.executeQueryAsync(
Function.createDelegate(this, function() {
var siteInfo = '';
//The below line get the boolean value of master page editing is allowed on this site collection
if (oSite.get_allowMasterPageEditing())
siteInfo = 'MasterPage customization: Allowed';
else
siteInfo = 'MasterPage customization: Not Allowed';
alert(siteInfo.toString());
}),
Function.createDelegate(this, function(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}));
}
function injectMethod() {
enableMasterPageAccess();
}
ExecuteOrDelayUntilScriptLoaded(injectMethod, "sp.js");
Code Ref Enable / Disable Master Page Customization in Site Collection
Or use the following PowerShell Script
To enable Customizing Master Pages and Page Layouts
in SharePoint online by following the mentioned steps
Download and install SharePoint Online SDK.
Download the .ps1 file.
Open the file (you can do it also in NotePad)
Insert your data in these lines:
PowerShell
# Paths to SDK. Please verify location on your computer.
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
# Insert the credentials and the name of the admin site
$Username="[email protected]"
$AdminPassword=Read-Host -Prompt "Password" -AsSecureString
$Url="https://tenant.sharepoint.com/sites/teamsitewithlibraries"
$setting=$true

Ref for script Enable page editing when master page editing has been disabled for this site
Also, For SharePoint enterprise you can enable this option from the central administration > application management > select web application > general setting > SharePoint Designer > check Enable Customizing Master Pages and Layout Pages
.

Note: After you Enable Customizing Master Pages and Layout Pages
, if you tried to copy Seattle / Oslo Master Page , you should copy *.Html
file rather than the *.master
file.