Skip to main content

How do I view error logs and debug broken scripts in Tampermonkey?

How to use Tampermonkey (Simple Tutorial 2024)

Debugging broken userscripts or viewing error logs in Tampermonkey involves using the Tampermonkey Dashboard, the built-in Script Editor, and your browser's Developer Tools (F12).

1.Check the Tampermonkey Dashboard Action Log:Reveals top-level execution errors and execution status.

  1. Open the Tampermonkey Dashboard from the browser extensions menu.

  2. Go to the Settings tab.

  3. Under Config mode, select Advanced.

  4. Scroll down to the Logging section:

    • Set Log Level to Debug or Verbose.

  5. Switch to the Action Log tab at the top of the dashboard to view background error events, script injection failures, or permission blocks.

2.Inspect page console errors via Browser DevTools:Displays real-time JavaScript runtime exceptions and console logs.

Userscript execution errors (such as Uncaught TypeError or failed GM_xmlhttpRequest calls) print directly to the webpage's developer console.

  1. Navigate to the webpage where the script runs (e.g., [xbox.com/play](https://xbox.com/play)).

  2. Press F12 (or Ctrl + Shift + I / Cmd + Option + I) to open Developer Tools.

  3. Click the Console tab.

  4. In the console filter bar, ensure Errors and Warnings are checked.

  5. Look for error messages prefixed with [Tampermonkey] or the name of your script.

3.Use the built-in Script Editor Debugger:Enables syntax checking and breakpoint step-debugging.

  1. In the Tampermonkey Dashboard, click the script's name to open the code editor.

  2. Check the left gutter for red markers or warning icons indicating syntax errors or missing @grant rules.

  3. Add a debugger; statement directly inside the code block you want to inspect:

JavaScript

// Example: Step-debug inside an xCloud function
function modifyStreamSettings() {
    debugger; // Browser execution pauses here when DevTools is open
    let settings = GM_getValue("customSettings");
    console.log("Current Settings:", settings);
}
  1. Open the webpage with DevTools (F12) open. When the script executes, execution will automatically pause on the debugger; line, allowing you to step through code and inspect variables in the Sources tab.

4.Inspect GM_ API calls and Network requests:Uncovers failures in cross-domain requests or background scripts.

If a script fails while fetching external data:

  1. Open DevTools (F12) and switch to the Network tab.

  2. Filter by Fetch/XHR.

  3. If the script uses GM_xmlhttpRequest, check if missing headers or @connect rules in the script header are causing permission blocks:

JavaScript

// ==UserScript==
// @name         Debug Script
// @match        https://xbox.com/*
// @connect      api.github.com
// @grant        GM_xmlhttpRequest
// ==UserScript==
Common Tampermonkey Errors & Quick Fixes

Console Error
Cause
Fix

GM_setValue is not defined
Missing header permission
Add // @grant GM_setValue to the script metadata header block.

Refused to connect / Content Security Policy (CSP)
Webpage CSP blocks standard fetch()
Replace window.fetch calls with GM_xmlhttpRequest inside the script.

Script does not run
@match or @include pattern mismatch
Ensure URL pattern matches target page (e.g., [https://www.xbox.com/](https://www.xbox.com/)* vs [https://xbox.com/](https://xbox.com/)*).

Comments

Popular posts from this blog

Windows 7 Keyboard Shortcuts.

Keyboard shortcuts are combinations of two or more keys that, when pressed, can be used to perform a task that would typically require a mouse or other pointing device. Keyboard shortcuts can make it easier to interact with your computer, saving you time and effort as you work with Windows and other programs.  Most programs also provide accelerator keys that can make it easier to work with menus and other commands. Check the menus of programs for accelerator keys.  If a letter is underlined in a menu, that usually means that pressing the Alt key in combination with the underlined key will have the same effect as clicking that menu item. Pressing the Alt key in some programs, such as Paint and WordPad, shows commands that are labeled with additional keys that you can press to use them. Dialog box keyboard shortcuts. The following table contains keyboard shortcuts for use in dialog boxes. Press this key To do this: Ctrl+Tab Move forward through tabs...

Windows 7 consumer security software providers.

We recommend that you install security software to help protect your computer from viruses and other security threats, and that you keep your security software up to date. Some companies use products that appear to be antivirus programs to install viruses or malware on your computer. When you install the program, you might also be installing the virus or other malware, without knowing it. Many companies, including those listed on this page, distribute antivirus programs. You should carefully investigate the source of antivirus and other products before downloading and installing them. The companies listed below provide consumer security software that is compatible with Windows 7. Just click the company name to see the Windows 7-compatible product they offer. For business security software that is compatible with Windows 7, please visit the Windows 7 Compatibility Center or contact your security vendor of choice. Important: Before you install antivirus software, check to make s...

Windows Media Player 12 Themes for Windows 7

Bored of your default Windows Media Player Skins?. Grab some fresh and new Windows Media Player 12 themes for Windows 7 ! Windows Media Player 12 Codecs Windows Media Player 12 comes with support for DivX and MP4, but it still lacks supports for many other video formats. (amr | mpc | ofr | divx | mka | ape | flac | evo | flv | m4b | mkv | ogg | ogv | ogm | rmvb | xvid)รน A popular codec pack can be downloaded here and here . Windows Media Player 12 Skins The following skin packages includes some really awesome themes for your Windows Media Player: Alienware Theme Batman Theme Catwoman Theme Darkstar Theme Half-Life Theme Halo 2 Theme The Last Samurai Theme Stalker Theme XBOX Theme XSN Sports Them Download Windows Media Player Themes Pack 1 (70 Skins) Download Windows Media Player Themes Pack 2 (12 Skins) New Year Theme 2010 for Windows 7 This theme can be downloaded for free from uploaded.to Custom Search If you liked this article, subscribe t...