Skip to main content

Common errors

Accessibility permission denied

Error message:
Cause: Your terminal or IDE doesn’t have Accessibility permissions. Solution:
1

Open System Settings

Or manually: System Settings > Privacy & Security > Accessibility
2

Add your terminal

Click the + button and add:
  • Terminal.app
  • iTerm.app
  • VS Code
  • Your IDE
If the app is already in the list, try toggling it off and on.
3

Restart your terminal

Quit and relaunch your terminal completely for permissions to take effect.
4

Test access

If this works, permissions are correctly set.
See AXEngine.swift:378-386 for the access check implementation.
Changes to Accessibility permissions require a full restart of the app. Closing a window is not enough.

App not found

Error message:
Cause: Typo in app name, or app is not running. Solutions:
This lists all running GUI applications. Verify the exact name.
agent-native’s open command launches apps if they’re not running:
If the app name is ambiguous, use the bundle ID:
Find bundle IDs with:
App names are case-insensitive, but try exact capitalization:
See AXEngine.swift:56-63 for app finding logic.

Ref not resolving

Error message:
Cause: The UI structure changed since the last snapshot, invalidating the ref. Why this happens:
  • You clicked a navigation element (changed pane/view)
  • App loaded new content
  • A modal opened or closed
  • Window was resized
Solution:
Always re-snapshot after actions that change the UI structure.
Best practice:
See RefStore.swift for ref storage implementation.

Element not found

Error message:
Cause: The element doesn’t exist, or is hidden/disabled. Debugging steps:
1

Check if element exists

2

Check interactive-only flag

The -i flag filters to interactive elements. Try without it:
3

Increase depth

Default depth is 8. Some deep elements need more:
4

Wait for element to appear

Elements may load asynchronously:
5

Use find command

See FindCommand.swift and AXEngine.swift:278-356 for element finding logic.

Element not responding

Error message:
Cause: Element is disabled, hidden, or doesn’t support the action. Solutions:
If this returns false, the element can’t be interacted with.
Check:
  • AXEnabled: Should be true
  • Actions: Should include AXPress or relevant action
  • AXPosition: Element should be on-screen
See InspectCommand.swift for element inspection.

Timeout waiting for element

Error message:
Cause: Element never appeared within the timeout period. Solutions:
Take a snapshot to see what’s actually there:
Your filters might be too specific:
See WaitCommand.swift for wait implementation.

Debugging techniques

Capture full snapshots

When debugging, capture the full tree without filters:

Use JSON output for parsing

Compare snapshots

See how UI changes between actions:

Use screenshots for visual debugging

Inspect element details

Output includes:
  • Role and subrole
  • All attributes (title, label, value, etc.)
  • Available actions
  • Position and size
  • Enabled/focused state

Test commands incrementally

Build complex workflows step by step:

Enable verbose output

While agent-native doesn’t have a verbose flag, you can wrap commands in debug scripts:

Performance issues

Snapshots are slow

Cause: Deep trees with many elements take time to traverse. Solutions:
Remove empty structural elements:
Always use -i to filter to interactive elements:
Skip snapshots when you know what you’re looking for:
See SnapshotCommand.swift:26-33 for interactive role filtering.

App becomes unresponsive

Cause: Too many rapid commands can overwhelm the app. Solution: Add delays between commands:

Platform-specific issues

macOS version compatibility

Issue: Some features require macOS 13+. Check version:
Solution: Upgrade to macOS 13 (Ventura) or higher.

Accessibility API changes

Apple occasionally changes Accessibility APIs between macOS versions. Solution:
  1. Update agent-native to the latest version:
  2. Check for known issues on GitHub

Getting help

Check GitHub Issues

Search for similar problems and solutions

Run tests

Verify your installation:

Check accessibility

Use macOS Accessibility Inspector:
  • Open Xcode
  • Xcode > Open Developer Tool > Accessibility Inspector
  • Inspect app elements manually

File a bug

Include:
  • agent-native version (agent-native --version)
  • macOS version (sw_vers)
  • Full error message
  • Minimal reproduction steps

Quick reference

Essential debugging commands

Common error patterns

Next steps

System Settings guide

Learn System Settings automation patterns

Electron apps guide

Automate Slack, Discord, VS Code

Safari automation

Interact with web content

API reference

Complete command reference