Skip to main content
Reference for exception classes in the mobile-use SDK.

Import

Exception Hierarchy

Base Exception

MobileUseError

Base exception for all SDK errors.
Use this to catch any SDK-related error.

Agent Exceptions

AgentError

Base exception for agent-related errors.

AgentNotInitializedError

Raised when agent methods are called before initialization. Common cause: Calling run_task() before init()
Solution:

AgentProfileNotFoundError

Raised when a specified profile is not found. Common cause: Using a profile name that hasn’t been registered
Solution:

AgentTaskRequestError

Raised for task request validation errors. Common causes:
  • Invalid task configuration
  • Conflicting parameters

AgentInvalidApiKeyError

Raised when the Minitap API key is invalid or unauthorized. Common causes:
  • Incorrect API key
  • Expired API key
  • API key not set
Solution:

Device Exceptions

DeviceError

Base exception for device-related errors.

DeviceNotFoundError

Raised when no device is found or device becomes disconnected. Common causes:
  • No device connected
  • USB debugging not enabled
  • Device unplugged during operation
Solutions:
  1. Check device connection:
  1. Enable USB debugging (Android)
  2. Specify device explicitly:

Server Exceptions

ServerError

Base exception for server-related errors.

ServerStartupError

Raised when server startup fails. Common causes:
  • Port already in use
  • Missing dependencies (ADB for Android, idb for iOS)
  • Permission issues
Solutions:
  1. Kill zombie servers:
  1. Verify platform tools are installed:

Executable Exceptions

ExecutableNotFoundError

Raised when required system executables are not found in PATH. Common causes:
  • adb not installed (for Android)
  • idb not installed (for iOS)
  • xcrun not installed (for iOS on macOS)
Solutions:
  1. Install ADB (for Android):
  1. Install idb (for iOS):
  1. Install Xcode Command Line Tools (for iOS):

Platform Exceptions

PlatformServiceUninitializedError

Raised when attempting to use platform features without proper initialization. Common causes:
  • MINITAP_API_KEY not set in environment
  • No API key provided in PlatformTaskRequest
  • Platform service not configured
Solution:
Or provide API key directly:

PlatformServiceError

Base exception for platform service-related errors. Common causes:
  • Network connectivity issues
  • Platform API errors
  • Invalid task configuration on platform
Solutions:
  1. Check network connectivity
  2. Verify task exists on platform
  3. Check platform status at platform.mobile-use.ai

Exception Handling Best Practices

1. Always Clean Up

2. Handle Specific Exceptions

3. Check Initialization

4. Retry Logic

Complete Example

Next Steps

Troubleshooting

Common issues and solutions

Agent SDK

Agent class reference