gildas-lormeau/SingleFile · error · Error
Profile not found
Error message
Profile not found
What it means
Thrown by updateProfile(profileName, profile) in src/core/bg/config.js:584 when the given profileName does not exist in the list of stored profile names. It is a guard against updating a profile that has been deleted or was never created; callers should verify the profile name (e.g. via getProfileNames) before attempting an update, and surface a user-facing error prompting them to pick an existing profile.
Source
Thrown at src/core/bg/config.js:584
let selectedProfileName;
if (rule) {
const profileName = rule[autoSave ? "autoSaveProfile" : "profile"];
selectedProfileName = profileName == CURRENT_PROFILE_NAME ? tabProfileName : profileName;
} else {
selectedProfileName = tabProfileName;
}
const profile = await getProfile(selectedProfileName);
const options = Object.assign({ profileName: selectedProfileName }, profile);
if (!BACKGROUND_SAVE_SUPPORTED) {
options.backgroundSave = false;
}
return options;
}
async function updateProfile(profileName, profile) {
const profileNames = await getProfileNames();
if (!profileNames.includes(profileName)) {
throw new Error("Profile not found");
}
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");
}View on GitHub (pinned to 517fb7c5cf)
Solutions
- Confirm the profile exists with getProfileNames() before updating
- Recreate the profile if it was deleted, then re-apply the update
- Refresh the UI's profile list after any create/rename/delete to avoid stale names
- Catch the error and fall back to createProfile if creating is acceptable
Example fix
// before
await config.updateProfile('work', partial);
// after
const names = await config.getProfileNames();
if (!names.includes('work')) await config.createProfile('work', 'default');
await config.updateProfile('work', partial); Defensive patterns
Strategy: validation
Validate before calling
const names = await config.getProfileNames(); if (!names.includes(profileName)) await config.createProfile(profileName, 'default');
Type guard
const profileExists = async (n) => (await config.getProfileNames()).includes(n);
Try / catch
try { await updateProfile(name, profile); } catch (e) { if (e.message === 'Profile not found') await recreateAndApply(name, profile); else throw e; } Prevention
- Refresh profile lists after any create/rename/delete
- Don't cache profile names across long-lived UI sessions
- Create-before-update when existence is uncertain
- Validate names against the live list, not stored copies
When it happens
Trigger: updateProfile(name, profile) called for a name never created, or one that was deleted/renamed before the update — often via onMessage from a stale UI state.
Common situations: Options page kept open while the profile was deleted in another tab; renaming a profile then applying saved edits under the old name; typos in programmatic profile names; storage cleared between calls.
Related errors
- SingleFile is disabled for this URL
- Duplicate profile name
- Default settings cannot be renamed
- Default settings cannot be deleted
- URL not found
AI-assisted analysis of gildas-lormeau/SingleFile@517fb7c5cf (2026-09-01).
Data as JSON: /api/errors/980fe3c18a8a4e58.
Report an issue: GitHub.