Skip to content

[pigeon] ProxyApi classes throws IllegalArgumentException on android phones #174134

@JavesonYehudi

Description

@JavesonYehudi

Steps to reproduce

We use a wrapper around the Auth0 library, leveraging Proxy to support our use case. Recently, we observed that some users on slower Android devices encounter a strange app crash that shouldn’t happen.
The exception occurs even though the generated code correctly maps the model that triggers it.

We were not able to reproduce it locally without adding a delay to the generated code - as we suspect that the Credentials object is taking a bit longer to be generated, as I described here, which was closed and considered invalid.

Expected results

Auth0 Credentials object

Actual results

Unsupported value: 'Credentials(idToken='xxxxx', accessToken='xxxxx', type='Bearer', refreshToken='xxxxx', expiresAt='Mon Aug 18 14:50:47 GMT+02:00 2025', scope='null')' of type 'com.auth0.android.result.Credentials'

Code sample

Code sample
override fun writeValue(stream: ByteArrayOutputStream, value: Any?) {
    if (value is Boolean || value is ByteArray || value is Double || value is DoubleArray || value is FloatArray || value is Int || value is IntArray || value is List<*> || value is Long || value is LongArray || value is Map<*, *> || value is String || value == null) {
      super.writeValue(stream, value)
      return
    }

    if (value is com.auth0.android.Auth0) {
      registrar.getPigeonApiWebAuth().pigeon_newInstance(value) { }
    }
     else if (value is com.olx.android_auth.request.CustomClient) {
      registrar.getPigeonApiOkHttpClient().pigeon_newInstance(value) { }
    }
     else if (value is com.olx.android_auth.request.CronetClient) {
      registrar.getPigeonApiCronetClient().pigeon_newInstance(value) { }
    }
     else if (value is com.auth0.android.request.NetworkingClient) {
      registrar.getPigeonApiNetworkingClient().pigeon_newInstance(value) { }
    }
     else if (value is com.olx.android_auth.request.DefaultDnsResolver) {
      registrar.getPigeonApiDefaultDnsResolver().pigeon_newInstance(value) { }
    }
     else if (value is com.olx.android_auth.request.DnsOverHttp) {
      registrar.getPigeonApiDnsOverHttp().pigeon_newInstance(value) { }
    }
     else if (value is com.olx.android_auth.request.CustomDns) {
      registrar.getPigeonApiCustomDns().pigeon_newInstance(value) { }
    }
     else if (value is com.olx.android_auth.model.LoginOptions) {
      registrar.getPigeonApiLoginOptions().pigeon_newInstance(value) { }
    }
     else if (value is com.olx.android_auth.model.LogoutOptions) {
      registrar.getPigeonApiLogoutOptions().pigeon_newInstance(value) { }
    }
     else if (value is com.auth0.android.authentication.storage.SecureCredentialsManager) {
      registrar.getPigeonApiCredentialsManager().pigeon_newInstance(value) { }
    }
     else if (value is com.olx.android_auth.model.CredentialsOptions) {
      registrar.getPigeonApiCredentialsOptions().pigeon_newInstance(value) { }
    }
     else if (value is com.auth0.android.result.Credentials) {
      registrar.getPigeonApiCredentialsDTO().pigeon_newInstance(value) { }
    }
     else if (value is com.auth0.android.result.UserProfile) {
      registrar.getPigeonApiUserProfileDTO().pigeon_newInstance(value) { }
    }

    when {
      registrar.instanceManager.containsInstance(value) -> {
        stream.write(128)
        writeValue(stream, registrar.instanceManager.getIdentifierForStrongReference(value))
      }
      else -> throw IllegalArgumentException("Unsupported value: '$value' of type '${value.javaClass.name}'")
    }
  }

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.29.3, on macOS 15.6 24G84 darwin-arm64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 16.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2025.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2024.3.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2025.2)
[✓] VS Code (version 1.102.3)
[✓] VS Code (version 1.99.3)
[✓] Connected device (5 available)
[✓] Network resources

• No issues found!

Edit note:
Initially We thought only slower phones were being impacted, but we could see Galaxy s23 also being impacted.

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listc: crashStack traces logged to the consolep: pigeonrelated to pigeon messaging codegen toolpackageflutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyteam-ecosystemOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions