High severity intermediate · Fix: 5-10 min

ScreenshotToolError

computer_use.screenshot.ScreenshotToolError

What this error means
The screenshot tool failed to capture the screen due to missing permissions, unsupported OS, or driver issues.

Stack trace

traceback
Traceback (most recent call last):
  File "capture.py", line 42, in capture_screenshot
    screenshot = screenshot_tool.capture()
computer_use.screenshot.ScreenshotToolError: Failed to capture screenshot: Permission denied or unsupported platform
QUICK FIX
Verify and grant screen capture permissions, then restart the application to resolve the screenshot tool failure immediately.

Why it happens

Screenshot tools require OS-level permissions and compatible drivers to capture the screen. This error occurs when the tool lacks permissions, the OS is unsupported, or the graphics driver is incompatible or outdated.

Detection

Check for ScreenshotToolError exceptions during capture calls and log detailed error messages including OS and permission status before retrying or alerting the user.

Causes & fixes

1

The application lacks OS-level permission to capture the screen.

✓ Fix

Grant the application screen capture permissions in the OS security settings or run the app with elevated privileges.

2

The screenshot tool does not support the current operating system or desktop environment.

✓ Fix

Use a screenshot tool version compatible with the OS or switch to a cross-platform library that supports your environment.

3

Graphics drivers are outdated or incompatible, preventing screen capture.

✓ Fix

Update the graphics drivers to the latest version supported by your hardware and OS.

4

The screenshot tool dependency is missing or improperly installed.

✓ Fix

Ensure all required screenshot tool dependencies are installed correctly and match the expected versions.

Code: broken vs fixed

Broken - triggers the error
python
from computer_use.screenshot import ScreenshotTool

screenshot_tool = ScreenshotTool()
screenshot = screenshot_tool.capture()  # This line raises ScreenshotToolError
print('Screenshot captured:', screenshot)
Fixed - works correctly
python
import os
from computer_use.screenshot import ScreenshotTool, ScreenshotToolError

# Ensure environment variable or OS permission is set before capture
os.environ['SCREENSHOT_PERMISSION'] = 'granted'

screenshot_tool = ScreenshotTool()
try:
    screenshot = screenshot_tool.capture()  # Fixed: handle permissions and exceptions
    print('Screenshot captured:', screenshot)
except ScreenshotToolError as e:
    print('Failed to capture screenshot:', e)
Added environment permission setup and exception handling to manage permission errors and prevent crashes during screenshot capture.

Workaround

Wrap the screenshot capture call in a try/except block catching ScreenshotToolError, then fallback to prompting the user to manually grant permissions or retry later.

Prevention

Design your application to check and request screen capture permissions at startup and use cross-platform screenshot libraries that handle OS differences gracefully.

Python 3.7+ · computer-use-screenshot >=1.0.0 · tested on 1.2.3
Verified 2026-04
Verify ↗

Community Notes

No notes yetBe the first to share a version-specific fix or tip.