gildas-lormeau/SingleFile · error · Error

Default settings cannot be renamed

Error message

Default settings cannot be renamed

What it means

Thrown by renameProfile(oldProfileName, profileName) in src/core/bg/config.js:604 when an attempt is made to rename the built-in default profile (DEFAULT_PROFILE_NAME, e.g. "Default settings"). The default profile is fixed by design; callers should disallow rename operations on it in the UI and only permit renaming user-created profiles.

Source

Thrown at src/core/bg/config.js:604

	const previousProfile = await getProfile(profileName);
	Object.keys(previousProfile).forEach(key => {
		profile[key] = profile[key] === undefined ? previousProfile[key] : profile[key];
	});
	await setProfile(profileName, profile);
}

async function renameProfile(oldProfileName, profileName) {
	const profileNames = await getProfileNames();
	const allTabsData = await tabsData.get();
	const rules = await getRules();
	if (!profileNames.includes(oldProfileName)) {
		throw new Error("Profile not found");
	}
	if (profileNames.includes(profileName)) {
		throw new Error("Duplicate profile name");
	}
	if (oldProfileName == DEFAULT_PROFILE_NAME) {
		throw new Error("Default settings cannot be renamed");
	}
	if (allTabsData.profileName == oldProfileName) {
		allTabsData.profileName = profileName;
		await tabsData.set(allTabsData);
	}
	rules.forEach(rule => {
		if (rule.profile == oldProfileName) {
			rule.profile = profileName;
		}
		if (rule.autoSaveProfile == oldProfileName) {
			rule.autoSaveProfile = profileName;
		}
	});
	const profile = await getProfile(oldProfileName);
	await configStorage.remove([PROFILE_NAME_PREFIX + oldProfileName]);
	await configStorage.set({ [PROFILE_NAME_PREFIX + profileName]: profile, rules });
}

View on GitHub (pinned to 517fb7c5cf)

Solutions

  1. Skip the default profile in rename loops (check against the default profile name before renaming)
  2. Only allow rename actions on user-created profiles in UI code
  3. Catch the error and ignore it for the default profile
  4. Create a copy under a new name instead of renaming the default

Example fix

// before
for (const name of names) await config.renameProfile(name, name + '-old');
// after
for (const name of names) {
  if (name === 'default') continue; // skip default profile
  await config.renameProfile(name, name + '-old');
}
Defensive patterns

Strategy: validation

Validate before calling

// default profile name per config.DEFAULT_PROFILE_NAME (e.g. 'default')
if (oldProfileName === 'default') throw new Skip();

Type guard

const isDefaultProfile = (n) => n === config.DEFAULT_PROFILE_NAME;

Try / catch

try { await renameProfile(name, newName); } catch (e) { if (e.message === 'Default settings cannot be renamed') return; throw e; }

Prevention

When it happens

Trigger: renameProfile(DEFAULT_PROFILE_NAME, newName) called with the default profile name as the source — from UI misuse or scripts iterating all profiles and renaming each.

Common situations: Bulk rename scripts that don't skip the default profile; automation treating default like a normal profile; UI allowing rename on the default row by mistake.

Related errors


AI-assisted analysis of gildas-lormeau/SingleFile@517fb7c5cf (2026-09-01). Data as JSON: /api/errors/12fd3c106fb7fdf9. Report an issue: GitHub.