pear-devs/pear-desktop · warning · Error
Duplicated Userscript Calling
Error message
Duplicated Userscript Calling
What it means
This userscript (CPU Tamer by AnimationFrame) sets a flag on the window object ('nzsxclvflluv') to prevent running twice in the same page. If the flag is already set — i.e. the script was injected a second time into the same window — it immediately throws 'Duplicated Userscript Calling'.
Source
Thrown at src/plugins/performance-improvement/scripts/cpu-tamer/cpu-tamer-by-animationframe.js:36
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/* oxlint-disable */
export const injectCpuTamerByAnimationFrame = ((__CONTEXT__) => {
'use strict';
const win = this instanceof Window ? this : window;
// Create a unique key for the script and check if it is already running
const hkey_script = 'nzsxclvflluv';
if (win[hkey_script]) throw new Error('Duplicated Userscript Calling'); // avoid duplicated scripting
win[hkey_script] = true;
/** @type {globalThis.PromiseConstructor} */
const Promise = (async () => { })().constructor; // hacks Promise in WaterFox Classic and "Promise.resolve(0)" nevers resolve.
const PromiseExternal = ((resolve_, reject_) => {
const h = (resolve, reject) => { resolve_ = resolve; reject_ = reject };
return class PromiseExternal extends Promise {
constructor(cb = h) {
super(cb);
if (cb === h) {
/** @type {(value: any) => void} */
this.resolve = resolve_;
/** @type {(reason?: any) => void} */
this.reject = reject_;
}
}
};
})();View on GitHub (pinned to 1e2aac5706)
Solutions
- Uninstall/disable the standalone userscript version if the plugin already injects it
- Enable only one plugin that ships this script
- Reload the page after disabling duplicates so the window flag resets
- If you maintain an injector, check for the flag (win.nzsxclvflluv) before injecting
Example fix
// before injectUserscript(cpuTamerSource); // called on every plugin enable // after if (!(window as any).nzsxclvflluv) injectUserscript(cpuTamerSource);
Defensive patterns
Strategy: try-catch
Validate before calling
if (!(window as any).nzsxclvflluv) injectUserscript(cpuTamerSrc);
Try / catch
inject(cpuTamerSrc).catch((e) => { if (!/Duplicated Userscript/.test(e.message)) throw e; }); Prevention
- Enable only one plugin/variant that ships this script
- Remove standalone userscript-manager copies when the plugin injects it
- Reload the page after toggling plugins to clear the singleton flag
When it happens
Trigger: The script being injected twice into one page: both the app's bundled copy and a manually installed userscript-manager copy; a plugin reinstall injecting again without reload; two different plugins shipping the same script; SPA navigation re-running injection into the same window.
Common situations: Installing the CPU Tamer userscript in Tampermonkey while the performance-improvement plugin also injects it; enabling two plugins that both bundle cpu-tamer; stale injection after hot-reload during development.
Related errors
AI-assisted analysis of pear-devs/pear-desktop@1e2aac5706 (2026-08-27).
Data as JSON: /api/errors/fc9c3146053ecf2f.
Report an issue: GitHub.