Skip to content

Fix AttributeError in warn_about_older_operating_systems when device_state not yet set#788

Open
uceka wants to merge 1 commit intosensepost:masterfrom
uceka:fix/warn_about_older_os_guard_device_state
Open

Fix AttributeError in warn_about_older_operating_systems when device_state not yet set#788
uceka wants to merge 1 commit intosensepost:masterfrom
uceka:fix/warn_about_older_os_guard_device_state

Conversation

@uceka
Copy link

@uceka uceka commented Feb 25, 2026

Fix AttributeError in warn_about_older_operating_systems when device_state is not yet set

Problem

When running objection -N -h <host> -n "<app>" start (network/remote connection), the following error occurs:

AttributeError: 'DeviceState' object has no attribute 'platform'

warn_about_older_operating_systems() is invoked from the start command before device_state.platform and device_state.version are populated. DeviceState does not initialize these in __init__; they are set later via set_platform() / set_version(). When connecting to a remote frida-server, the state may not be ready at the time the warning runs.

Solution

  • Use getattr(device_state, 'platform', None) and getattr(device_state, 'version', None) to safely read attributes.
  • Return early when either is None, skipping the Android/iOS version warnings until device state is available.
  • Use the local platform and version variables in the conditionals and format strings to avoid repeated attribute access.

Testing

  • Reproduced with: objection -N -h 127.0.0.1 -n "Iru Access" start
  • After the fix, the session starts without AttributeError and the REPL works as expected.

…state not yet set

warn_about_older_operating_systems() is called from the start command before
device_state.platform and device_state.version are populated (e.g. when
connecting to a remote frida-server). This caused:

  AttributeError: 'DeviceState' object has no attribute 'platform'

Guard with getattr(..., None) and return early when platform or version
are not set, so the version warnings are skipped until device state is
available.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants