gildas-lormeau/SingleFile · error · Error
URL not found
Error message
URL not found
What it means
updateRule looks up the rule to edit with rules.find(rule => rule.url == url) and throws 'URL not found' when no rule matches. The original URL acts as the lookup key; if no rule exists with exactly that URL, there is nothing to update.
Source
Thrown at src/core/bg/config.js:708
throw new Error("URL is empty");
}
const rules = await getRules();
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;
}
View on GitHub (pinned to 517fb7c5cf)
Solutions
- Refresh the rule list (getRules) and confirm the URL exists before updating.
- Catch the error and reload the rules UI so the user sees current state.
- Ensure the url string matches the stored one exactly (trim whitespace, same case).
Example fix
// before
await updateRule(staleUrl, newURL, profile);
// after
const rules = await getRules();
if (!rules.some(r => r.url == staleUrl)) { await refreshRulesUI(); return; }
await updateRule(staleUrl, newURL, profile); Defensive patterns
Strategy: try-catch
Validate before calling
const rules = await getRules();
if (!rules.some(r => r.url == url)) { await refreshRulesUI(); return; } Try / catch
try { await updateRule(url, newURL, p, asp); } catch (e) { if (e.message === 'URL not found') { await refreshRulesUI(); notify('Rule no longer exists'); } else throw e; } Prevention
- Re-fetch rules before edits to avoid stale state
- Compare URLs exactly (trim, case) as stored
- Handle concurrent edits across multiple tabs
When it happens
Trigger: Calling updateRule with a url that was never added, or one that was already renamed/deleted; passing an untrimmed or differently-cased URL than the stored one.
Common situations: Two tabs editing rules concurrently (the other tab deleted/renamed the rule first); stale UI state showing a rule that no longer exists; passing the rule's display URL instead of the stored pattern.
Related errors
- URL is empty
- URL already exists
- New URL already exists
- Profile not found
- Default settings cannot be deleted
AI-assisted analysis of gildas-lormeau/SingleFile@517fb7c5cf (2026-09-01).
Data as JSON: /api/errors/06f0826df71ed366.
Report an issue: GitHub.