name: tampermonkey-script-debug
description: Debug Tampermonkey userscript when UI button/injection doesn't appear on target page
Tampermonkey Script Debug — Browser Button Not Appearing
Trigger
When a Tampermonkey userscript (*.user.js) is installed but its UI element (button/toast/injection) doesn't appear on the target page, and the script's logic seems correct.
Diagnosis Steps (in order)
1. Verify script is actually installed
Tampermonkey Dashboard → confirm script shows "Enabled" and "Installed" (not "Error")
2. Check @match covers the URL
Open DevTools (F12) → Console, type:
`javascript
location.href
`
Confirm the URL matches the @match pattern in the script header (e.g. https://app2.paineldocorretor.com.br/crm/*)
3. Check if script is running at all
Look for script's console prefix (e.g. [RSSyncV3]) in DevTools Console. If no prefix messages appear, script is not executing.
4. Check for DOM elements created by script
`javascript
document.getElementById('rssync-toast'); // or the element ID used by script
`
5. Verify @match pattern in Resources tab
Tampermonkey Dashboard → script → Resources tab → confirm the @match URL covers the current page URL.
6. Force update the script
The browser may be running a cached old version. Tampermonkey Dashboard → "Check for updates" OR uninstall and reinstall from the raw URL.
Critical Discovery: Terminal Display Masking
Problem: grep or cat in terminal may display a URL as https:...oken making it look corrupted. This is terminal visual masking of URLs, NOT actual file corruption.
Fix: Use Python byte-level reading to verify actual file contents:
`python
with open(path, 'rb') as f:
data = f.read()
Find the URL bytes
idx = data.find(b'https://auth.')
print(data[idx:idx+80])
`
Known Tools
- -
node --check script.user.js— validates Tampermonkey script syntax (exit 0 = OK). Tampermonkey's own "Verify syntax" may show warnings that are false positives. - -
CF-Cache-Status: BYPASSin curl output = Cloudflare is not caching, fresh content served. - - sed/patch may appear to succeed but not persist changes if file permissions are wrong or the string pattern doesn't match exactly. Always verify with Python byte-read.
- - Tampermonkey cache: even after updating the raw URL file, browser may serve old version. Always force "Check for updates" or reinstall.