gildas-lormeau/SingleFile · error · Error
New URL already exists
Error message
New URL already exists
What it means
When renaming a rule's URL, updateRule checks that no OTHER rule already uses newURL (rules.find(rule => rule.url == newURL && rule.url != url)) and throws 'New URL already exists' on collision. This preserves the one-rule-per-URL invariant after the rename.
Source
Thrown at src/core/bg/config.js:711
await configStorage.set({ rules: rules.filter(rule => rule.url != url) });
}
async function deleteRules(profileName) {
const rules = await getRules();
await configStorage.set({ rules: profileName ? rules.filter(rule => rule.autoSaveProfile != profileName && rule.profile != profileName) : [] });
}
async function updateRule(url, newURL, profile, autoSaveProfile) {
if (!url || !newURL) {
throw new Error("URL is empty");
}
const rules = await getRules();
const urlConfig = rules.find(rule => rule.url == url);
if (!urlConfig) {
throw new Error("URL not found");
}
if (rules.find(rule => rule.url == newURL && rule.url != url)) {
throw new Error("New URL already exists");
}
urlConfig.url = newURL;
urlConfig.profile = profile;
urlConfig.autoSaveProfile = autoSaveProfile;
await configStorage.set({ rules });
}
async function getAuthInfo() {
return (await configStorage.get()).authInfo;
}
async function getDropboxAuthInfo() {
return (await configStorage.get()).dropboxAuthInfo;
}
async function setAuthInfo(authInfo) {
await configStorage.set({ authInfo });
}View on GitHub (pinned to 517fb7c5cf)
Solutions
- Pre-check with getRules(): if (rules.some(r => r.url == newURL && r.url != url)) show a conflict message before calling.
- Delete the conflicting rule first if it should be replaced, then update.
- Catch the error and prompt the user to choose a different URL.
Example fix
// before
await updateRule(url, newURL, profile);
// after
const rules = await getRules();
if (rules.some(r => r.url == newURL && r.url != url)) throw new Error('Choose a different URL');
await updateRule(url, newURL, profile); Defensive patterns
Strategy: validation
Validate before calling
const rules = await getRules();
if (rules.some(r => r.url == newURL && r.url != url)) throw new Error('New URL already in use');
await updateRule(url, newURL, profile, autoSaveProfile); Try / catch
try { await updateRule(url, newURL, p, asp); } catch (e) { if (e.message === 'New URL already exists') notify('Another rule uses this URL'); else throw e; } Prevention
- Check for collisions in the UI before renaming
- Order bulk renames to avoid mid-way conflicts
- Prompt users to pick a different URL on collision
When it happens
Trigger: Calling updateRule(urlA, urlB, ...) where urlB is already assigned to a different rule; e.g. editing rule A's URL to the exact value of rule B.
Common situations: User renames a rule to a URL that was previously auto-saved by autoSaveProfile; bulk renames applied in an order that collides mid-way.
Related errors
AI-assisted analysis of gildas-lormeau/SingleFile@517fb7c5cf (2026-09-01).
Data as JSON: /api/errors/b9dd99eb19839924.
Report an issue: GitHub.