Auth state is an invalid state for existing user and email OTP on Android
Before opening, please confirm:
- [x] I have searched for duplicate or closed issues and discussions.
Language and Async Model
Kotlin - Coroutines
Amplify Categories
Authentication
Gradle script dependencies
amplify = "2.27.3"
amplify-auth-cognito = { module = "com.amplifyframework:aws-auth-cognito", version.ref = "amplify" }
amplify-core-kotlin = { module = "com.amplifyframework:core-kotlin", version.ref = "amplify" }
Environment information
------------------------------------------------------------
Gradle 8.13
------------------------------------------------------------
Build time: 2025-02-25 09:22:14 UTC
Revision: 073314332697ba45c16c0a0ce1891fa6794179ff
Kotlin: 2.0.21
Groovy: 3.0.22
Ant: Apache Ant(TM) version 1.10.15 compiled on August 25 2024
Launcher JVM: 21.0.7 (Azul Systems, Inc. 21.0.7+6-LTS)
Daemon JVM: /Library/Java/JavaVirtualMachines/zulu-21.jdk/Contents/Home (no JDK specified, using current Java home)
OS: Mac OS X 15.4.1 aarch64
Please include any relevant guides or documentation you're referencing
https://docs.amplify.aws/android/build-a-backend/auth/connect-your-frontend/sign-in/#email-otp
Describe the bug
When calling amplify auth signup with an email and no password, I am getting an UsernameExistsException as expected in my case.
However when I follow that call with auth.confirmSignIn(AuthFactorType.EmailOtp.value) in order to start the email OTP sign in process, I am getting:
InvalidStateException{message=Auth state is an invalid state, cannot process the request., cause=null, recoverySuggestion=Operation performed is not a valid operation for the current auth state.}
at com.amplifyframework.auth.cognito.RealAWSCognitoAuthPlugin$confirmSignIn$1.invoke(RealAWSCognitoAuthPlugin.kt:404)
at com.amplifyframework.auth.cognito.RealAWSCognitoAuthPlugin$confirmSignIn$1.invoke(RealAWSCognitoAuthPlugin.kt:372)
at com.amplifyframework.statemachine.StateMachine$getCurrentState$1.invokeSuspend(StateMachine.kt:125)
Reproduction steps (if applicable)
- Initialize Amplify auth on Android
- Sign up with an existing User
- Receive UsernameExistsException as expected
- Start Signin Email OTP process as per documentation
- Notice the error on the first
confirmSignIncall
Code Snippet
override suspend fun createUserWithEmail(firstName: String, email: String): SignUpResult {
logger.d { "Auth createUserWithEmail" }
try {
val result = auth.signUp(
email,
null,
AuthSignUpOptions.builder()
.userAttribute(AuthUserAttributeKey.email(), email)
.userAttribute(AuthUserAttributeKey.givenName(), firstName)
.build(),
)
return if (result.isSignUpComplete) {
logger.i { "Sign up complete" }
SignUpResult.Complete
} else if (result.nextStep.signUpStep == AuthSignUpStep.CONFIRM_SIGN_UP_STEP) {
logger.i { "Sign up complete with next step" }
SignUpResult.ConfirmSignUp
} else {
val error = IllegalStateException("Unknown error, $result")
logger.e(error) { "Sign up failed" }
SignUpResult.Error(error)
}
} catch (e: AuthException) {
return when (e) {
is UsernameExistsException -> {
logger.i { "Auth Email already exist" }
try {
val result = auth.confirmSignIn(AuthFactorType.EmailOtp.value)
if (result.nextStep.signInStep == AuthSignInStep.CONFIRM_SIGN_IN_WITH_OTP) {
logger.d { "Auth already exist need to confirm" }
SignUpResult.AlreadyExistConfirmSignIn
} else {
val e = IllegalStateException("Unknown auth error $result")
logger.e(e) { "Auth confirmSignIn after Sign up failed" }
SignUpResult.Error(e)
}
} catch(e: AuthException){
logger.e(e) { "Auth confirmSignIn afterSign up failed" }
SignUpResult.Error(e)
}
}
is UnknownException -> {
if (e.cause is HttpException) {
logger.i { "Connectivity issue" }
SignUpResult.ConnectivityIssue
} else {
logger.e(e) { "Sign up failed" }
SignUpResult.Error(e)
}
}
else -> {
logger.e(e) { "Sign up failed" }
SignUpResult.Error(e)
}
}
}
}
Initialization code:
Amplify.addPlugin(AWSCognitoAuthPlugin())
Amplify.addPlugin(AndroidLoggingPlugin(LogLevel.VERBOSE))
scope.launch(appCoroutineDispatchers.io) {
Amplify.configure(AmplifyOutputs(rawOutput), application)
}
Log output
---------------------------- PROCESS STARTED (22401) for package com.enkihangouts.android.qa.debug ----------------------------
2025-05-15 18:01:09.009 22401-22401 ApplicationLoaders com.enkihangouts.android.qa.debug D Returning zygote-cached class loader: /system_ext/framework/androidx.window.extensions.jar
2025-05-15 18:01:09.009 22401-22401 ApplicationLoaders com.enkihangouts.android.qa.debug D Returning zygote-cached class loader: /system_ext/framework/androidx.window.sidecar.jar
2025-05-15 18:01:09.012 22401-22401 ziparchive com.enkihangouts.android.qa.debug W Unable to open '/data/data/com.enkihangouts.android.qa.debug/code_cache/.overlay/base.apk/classes13.dm': No such file or directory
2025-05-15 18:01:09.014 22401-22401 ziparchive com.enkihangouts.android.qa.debug W Unable to open '/data/app/~~yYaKK9QBlKXAhNgoUwDh9w==/com.enkihangouts.android.qa.debug-iSdLNcvwTHBjoWBpTt6OJA==/base.dm': No such file or directory
2025-05-15 18:01:09.014 22401-22401 ziparchive com.enkihangouts.android.qa.debug W Unable to open '/data/app/~~yYaKK9QBlKXAhNgoUwDh9w==/com.enkihangouts.android.qa.debug-iSdLNcvwTHBjoWBpTt6OJA==/base.dm': No such file or directory
2025-05-15 18:01:10.210 22401-22401 nativeloader com.enkihangouts.android.qa.debug D Configuring clns-7 for other apk /data/app/~~yYaKK9QBlKXAhNgoUwDh9w==/com.enkihangouts.android.qa.debug-iSdLNcvwTHBjoWBpTt6OJA==/base.apk. target_sdk_version=35, uses_libraries=, library_path=/data/app/~~yYaKK9QBlKXAhNgoUwDh9w==/com.enkihangouts.android.qa.debug-iSdLNcvwTHBjoWBpTt6OJA==/lib/arm64:/data/app/~~yYaKK9QBlKXAhNgoUwDh9w==/com.enkihangouts.android.qa.debug-iSdLNcvwTHBjoWBpTt6OJA==/base.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand:/data/user/0/com.enkihangouts.android.qa.debug
2025-05-15 18:01:10.211 22401-22401 CompatChangeReporter com.enkihangouts.android.qa.debug D Compat change id reported: 202956589; UID 10350; state: ENABLED
2025-05-15 18:01:10.224 22401-22401 GraphicsEnvironment com.enkihangouts.android.qa.debug V Currently set values for:
2025-05-15 18:01:10.224 22401-22401 GraphicsEnvironment com.enkihangouts.android.qa.debug V angle_gl_driver_selection_pkgs=[com.android.angle, com.linecorp.b612.android, com.campmobile.snow, com.google.android.apps.tachyon]
2025-05-15 18:01:10.224 22401-22401 GraphicsEnvironment com.enkihangouts.android.qa.debug V angle_gl_driver_selection_values=[angle, native, native, native]
2025-05-15 18:01:10.224 22401-22401 GraphicsEnvironment com.enkihangouts.android.qa.debug V com.enkihangouts.android.qa.debug is not listed in per-application setting
2025-05-15 18:01:10.224 22401-22401 GraphicsEnvironment com.enkihangouts.android.qa.debug V Neither updatable production driver nor prerelease driver is supported.
2025-05-15 18:01:10.273 22401-22401 SessionsDependencies com.enkihangouts.android.qa.debug D Dependency to CRASHLYTICS added.
2025-05-15 18:01:10.280 22401-22401 FirebaseApp com.enkihangouts.android.qa.debug I Device unlocked: initializing all Firebase APIs for app [DEFAULT]
2025-05-15 18:01:10.345 22401-22401 FirebaseSessions com.enkihangouts.android.qa.debug D Initializing Firebase Sessions SDK.
2025-05-15 18:01:10.363 22401-22401 FirebaseCrashlytics com.enkihangouts.android.qa.debug I Initializing Firebase Crashlytics 19.4.3 for com.enkihangouts.android.qa.debug
2025-05-15 18:01:10.387 22401-22401 SessionsDependencies com.enkihangouts.android.qa.debug D Subscriber CRASHLYTICS registered.
2025-05-15 18:01:10.418 22401-22429 ndroid.qa.debug com.enkihangouts.android.qa.debug W ClassLoaderContext classpath size mismatch. expected=1, found=0 (DLC[];PCL[base.apk*3864036239]{PCL[/system/framework/org.apache.http.legacy.jar*2884979375]#PCL[/system/framework/com.android.media.remotedisplay.jar*56884057]#PCL[/system/framework/com.android.location.provider.jar*690536414]#PCL[/system_ext/framework/androidx.window.extensions.jar*2579805202]#PCL[/system_ext/framework/androidx.window.sidecar.jar*3633536204]} | DLC[];PCL[])
2025-05-15 18:01:10.422 22401-22429 DynamiteModule com.enkihangouts.android.qa.debug I Considering local module com.google.android.gms.measurement.dynamite:141 and remote module com.google.android.gms.measurement.dynamite:147
2025-05-15 18:01:10.422 22401-22429 DynamiteModule com.enkihangouts.android.qa.debug I Selected remote version of com.google.android.gms.measurement.dynamite, version >= 147
2025-05-15 18:01:10.422 22401-22429 DynamiteModule com.enkihangouts.android.qa.debug V Dynamite loader version >= 2, using loadModule2NoCrashUtils
2025-05-15 18:01:10.433 22401-22401 FirebaseInitProvider com.enkihangouts.android.qa.debug I FirebaseApp initialization successful
2025-05-15 18:01:10.446 22401-22432 CompatChangeReporter com.enkihangouts.android.qa.debug D Compat change id reported: 311402873; UID 10350; state: ENABLED
2025-05-15 18:01:10.446 22401-22432 CompatChangeReporter com.enkihangouts.android.qa.debug D Compat change id reported: 323349338; UID 10350; state: ENABLED
2025-05-15 18:01:10.453 22401-22429 System com.enkihangouts.android.qa.debug W ClassLoader referenced unknown path:
2025-05-15 18:01:10.455 22401-22429 nativeloader com.enkihangouts.android.qa.debug D Configuring clns-8 for other apk . target_sdk_version=36, uses_libraries=, library_path=/data/app/~~CI4p6oGcrexODdsMehpang==/com.google.android.gms-hoWBeBX7vLWzdzeAB5SstA==/lib/arm64:/data/app/~~CI4p6oGcrexODdsMehpang==/com.google.android.gms-hoWBeBX7vLWzdzeAB5SstA==/base.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand:/data/user/0/com.google.android.gms
2025-05-15 18:01:10.471 22401-22429 ndroid.qa.debug com.enkihangouts.android.qa.debug W ClassLoaderContext classpath size mismatch. expected=1, found=2 (DLC[];PCL[base.apk*3864036239]{PCL[/system/framework/org.apache.http.legacy.jar*2884979375]#PCL[/system/framework/com.android.media.remotedisplay.jar*56884057]#PCL[/system/framework/com.android.location.provider.jar*690536414]#PCL[/system_ext/framework/androidx.window.extensions.jar*2579805202]#PCL[/system_ext/framework/androidx.window.sidecar.jar*3633536204]} | DLC[];PCL[/data/data/com.enkihangouts.android.qa.debug/code_cache/.overlay/base.apk/classes13.dex*1432946265:/data/app/~~yYaKK9QBlKXAhNgoUwDh9w==/com.enkihangouts.android.qa.debug-iSdLNcvwTHBjoWBpTt6OJA==/base.apk*1004901515]{PCL[/system_ext/framework/androidx.window.extensions.jar*2579805202]#PCL[/system_ext/framework/androidx.window.sidecar.jar*3633536204]})
2025-05-15 18:01:10.473 22401-22401 ndroid.qa.debug com.enkihangouts.android.qa.debug W Accessing hidden method Landroid/view/WindowManagerGlobal;->getInstance()Landroid/view/WindowManagerGlobal; (unsupported, reflection, allowed)
2025-05-15 18:01:10.473 22401-22401 ndroid.qa.debug com.enkihangouts.android.qa.debug W Accessing hidden field Landroid/view/WindowManagerGlobal;->mViews:Ljava/util/ArrayList; (unsupported, reflection, allowed)
2025-05-15 18:01:10.474 22401-22401 ndroid.qa.debug com.enkihangouts.android.qa.debug W Accessing hidden field Landroid/app/ActivityThread;->mH:Landroid/app/ActivityThread$H; (unsupported, reflection, allowed)
2025-05-15 18:01:10.474 22401-22401 ndroid.qa.debug com.enkihangouts.android.qa.debug W Accessing hidden method Landroid/app/ActivityThread;->currentActivityThread()Landroid/app/ActivityThread; (unsupported, reflection, allowed)
2025-05-15 18:01:10.474 22401-22401 ndroid.qa.debug com.enkihangouts.android.qa.debug W Accessing hidden field Landroid/os/Handler;->mCallback:Landroid/os/Handler$Callback; (unsupported, reflection, allowed)
2025-05-15 18:01:10.474 22401-22401 ndroid.qa.debug com.enkihangouts.android.qa.debug W Accessing hidden field Landroid/util/Singleton;->mInstance:Ljava/lang/Object; (unsupported, reflection, allowed)
2025-05-15 18:01:10.474 22401-22401 ndroid.qa.debug com.enkihangouts.android.qa.debug W Accessing hidden method Landroid/util/Singleton;->get()Ljava/lang/Object; (unsupported, reflection, allowed)
2025-05-15 18:01:10.474 22401-22401 ndroid.qa.debug com.enkihangouts.android.qa.debug W Accessing hidden field Landroid/app/ActivityManager;->IActivityManagerSingleton:Landroid/util/Singleton; (unsupported, reflection, allowed)
2025-05-15 18:01:10.500 22401-22430 LifecycleServiceBinder com.enkihangouts.android.qa.debug D Binding service to application.
2025-05-15 18:01:10.503 22401-22401 CompatChangeReporter com.enkihangouts.android.qa.debug D Compat change id reported: 312399441; UID 10350; state: ENABLED
2025-05-15 18:01:10.513 22401-22401 CompatChangeReporter com.enkihangouts.android.qa.debug D Compat change id reported: 279646685; UID 10350; state: ENABLED
2025-05-15 18:01:10.566 22401-22437 ndroid.qa.debug com.enkihangouts.android.qa.debug E No package ID 6d found for resource ID 0x6d0b000f.
2025-05-15 18:01:10.567 22401-22437 FA com.enkihangouts.android.qa.debug I App measurement initialized, version: 125000
2025-05-15 18:01:10.567 22401-22437 FA com.enkihangouts.android.qa.debug I To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
2025-05-15 18:01:10.568 22401-22437 FA com.enkihangouts.android.qa.debug I To enable faster debug mode event logging run:
adb shell setprop debug.firebase.analytics.app com.enkihangouts.android.qa.debug
2025-05-15 18:01:10.633 22401-22448 vulkan com.enkihangouts.android.qa.debug D searching for layers in '/data/app/~~yYaKK9QBlKXAhNgoUwDh9w==/com.enkihangouts.android.qa.debug-iSdLNcvwTHBjoWBpTt6OJA==/lib/arm64'
2025-05-15 18:01:10.633 22401-22448 vulkan com.enkihangouts.android.qa.debug D searching for layers in '/data/app/~~yYaKK9QBlKXAhNgoUwDh9w==/com.enkihangouts.android.qa.debug-iSdLNcvwTHBjoWBpTt6OJA==/base.apk!/lib/arm64-v8a'
2025-05-15 18:01:10.662 22401-22401 CompatChangeReporter com.enkihangouts.android.qa.debug D Compat change id reported: 309578419; UID 10350; state: ENABLED
2025-05-15 18:01:10.664 22401-22401 DesktopModeFlagsUtil com.enkihangouts.android.qa.debug D Toggle override initialized to: OVERRIDE_UNSET
2025-05-15 18:01:10.690 22401-22436 LeakCanary com.enkihangouts.android.qa.debug D LeakCanary is running and ready to detect memory leaks.
2025-05-15 18:01:10.721 22401-22401 ContentCaptureHelper com.enkihangouts.android.qa.debug I Setting logging level to OFF
2025-05-15 18:01:10.725 22401-22433 HttpEngine com.enkihangouts.android.qa.debug I Using default OkHttp5 Engine
2025-05-15 18:01:10.728 22401-22430 SessionLifecycleClient com.enkihangouts.android.qa.debug D Queued message 1. Queue size 1
2025-05-15 18:01:10.751 22401-22401 CompatChangeReporter com.enkihangouts.android.qa.debug D Compat change id reported: 352594277; UID 10350; state: ENABLED
2025-05-15 18:01:10.757 22401-22401 CompatChangeReporter com.enkihangouts.android.qa.debug D Compat change id reported: 349153669; UID 10350; state: ENABLED
2025-05-15 18:01:10.762 22401-22401 ndroid.qa.debug com.enkihangouts.android.qa.debug W Accessing hidden field Lcom/android/internal/policy/DecorView;->mWindow:Lcom/android/internal/policy/PhoneWindow; (unsupported, reflection, allowed)
2025-05-15 18:01:10.765 22401-22437 FA com.enkihangouts.android.qa.debug I Tag Manager is not found and thus will not be used
2025-05-15 18:01:10.782 22401-22401 SessionLifecycleService com.enkihangouts.android.qa.debug D Service created on process 22401
2025-05-15 18:01:10.783 22401-22401 SessionLifecycleService com.enkihangouts.android.qa.debug D Service bound to new client on process 22401
2025-05-15 18:01:10.790 22401-22461 SessionLifecycleService com.enkihangouts.android.qa.debug D App has not yet foregrounded. Using previously stored session.
2025-05-15 18:01:10.791 22401-22461 SessionLifecycleService com.enkihangouts.android.qa.debug D Client android.os.Messenger@fbaf3e9 bound at 768269858. Clients: 1
2025-05-15 18:01:10.805 22401-22426 FirebaseCrashlytics com.enkihangouts.android.qa.debug I No version control information found
2025-05-15 18:01:10.976 22401-22433 ndroid.qa.debug com.enkihangouts.android.qa.debug E Invalid resource ID 0x00000000.
2025-05-15 18:01:11.041 22401-22401 MeltingPotNavigator com.enkihangouts.android.qa.debug D resetRoot: newRoot:LoadingScreen. Current stack: [Record(screen=LoadingScreen, args={}, key=4c4284a6-0d35-40fd-9e06-fe76482cea37)]
2025-05-15 18:01:11.292 22401-22401 SessionLifecycleClient com.enkihangouts.android.qa.debug D Connected to SessionLifecycleService. Queue size 1
2025-05-15 18:01:11.293 22401-22421 SessionLifecycleClient com.enkihangouts.android.qa.debug D Sending lifecycle 1 to service
2025-05-15 18:01:11.293 22401-22461 SessionLifecycleService com.enkihangouts.android.qa.debug D Activity foregrounding at 768270368.
2025-05-15 18:01:11.293 22401-22461 SessionLifecycleService com.enkihangouts.android.qa.debug D Cold start detected.
2025-05-15 18:01:11.295 22401-22461 SessionLifecycleService com.enkihangouts.android.qa.debug D Generated new session.
2025-05-15 18:01:11.295 22401-22461 SessionLifecycleService com.enkihangouts.android.qa.debug D Broadcasting new session
2025-05-15 18:01:11.299 22401-22421 SessionFirelogPublisher com.enkihangouts.android.qa.debug D Data Collection is enabled for at least one Subscriber
2025-05-15 18:01:11.317 22401-22401 NavController com.enkihangouts.android.qa.debug I Navigating to WelcomeScreen
2025-05-15 18:01:11.317 22401-22401 MeltingPotNavigator com.enkihangouts.android.qa.debug D resetRoot: newRoot:WelcomeScreen. Current stack: [Record(screen=LoadingScreen, args={}, key=ed2d314a-60c4-463e-96cf-7ecabe1cccb1)]
2025-05-15 18:01:11.323 22401-22428 EventGDTLogger com.enkihangouts.android.qa.debug D Session Event Type: SESSION_START
2025-05-15 18:01:11.323 22401-22428 SessionFirelogPublisher com.enkihangouts.android.qa.debug D Successfully logged Session Start event.
2025-05-15 18:01:11.356 22401-22401 SessionLifecycleClient com.enkihangouts.android.qa.debug D Session update received.
2025-05-15 18:01:11.358 22401-22430 SessionLifecycleClient com.enkihangouts.android.qa.debug D Notified CRASHLYTICS of new session 256981d36ae64abcb888f8cceb4b6d54
2025-05-15 18:01:11.653 22401-22401 <no-tag> com.enkihangouts.android.qa.debug I Load image files/weird_barbarians.webp
2025-05-15 18:01:11.720 22401-22401 InsetsController com.enkihangouts.android.qa.debug D hide(ime(), fromIme=false)
2025-05-15 18:01:11.720 22401-22401 ImeTracker com.enkihangouts.android.qa.debug I com.enkihangouts.android.qa.debug:21a73c68: onCancelled at PHASE_CLIENT_ALREADY_HIDDEN
2025-05-15 18:01:11.731 22401-22401 Coil com.enkihangouts.android.qa.debug W No keyer is registered for data with type 'ByteArray'. Register Keyer<ByteArray> in the component registry to cache the output image in the memory cache.
2025-05-15 18:01:11.878 22401-22438 HWUI com.enkihangouts.android.qa.debug W Image decoding logging dropped!
2025-05-15 18:01:11.883 22401-22405 ndroid.qa.debug com.enkihangouts.android.qa.debug I Compiler allocated 5341KB to compile void android.view.ViewRootImpl.performTraversals()
2025-05-15 18:01:11.885 22401-22401 Coil com.enkihangouts.android.qa.debug I 🧠 Successful (MEMORY) - [B@54d6ce
2025-05-15 18:01:11.914 22401-22401 Auth com.enkihangouts.android.qa.debug I AuthState: UnAuthenticated
2025-05-15 18:01:15.671 22401-22482 ProfileInstaller com.enkihangouts.android.qa.debug D Installing profile for com.enkihangouts.android.qa.debug
2025-05-15 18:01:17.801 22401-22401 <no-tag> com.enkihangouts.android.qa.debug I Load image files/all_barbarians.webp
2025-05-15 18:01:17.860 22401-22401 Coil com.enkihangouts.android.qa.debug W No keyer is registered for data with type 'ByteArray'. Register Keyer<ByteArray> in the component registry to cache the output image in the memory cache.
2025-05-15 18:01:17.977 22401-22438 HWUI com.enkihangouts.android.qa.debug W Image decoding logging dropped!
2025-05-15 18:01:17.987 22401-22401 Coil com.enkihangouts.android.qa.debug I 🧠 Successful (MEMORY) - [B@b60e02d
2025-05-15 18:01:18.566 22401-22401 MeltingPotNavigator com.enkihangouts.android.qa.debug D goTo. Screen: SignUpScreen. Current stack: [Record(screen=WelcomeScreen, args={}, key=efb88cce-9203-4cec-928d-6eb5afaa9283)]
2025-05-15 18:01:19.142 22401-22401 Choreographer com.enkihangouts.android.qa.debug I Skipped 30 frames! The application may be doing too much work on its main thread.
2025-05-15 18:01:19.956 22401-22401 InsetsController com.enkihangouts.android.qa.debug D show(ime(), fromIme=false)
2025-05-15 18:01:19.957 22401-22401 ImeTracker com.enkihangouts.android.qa.debug I com.enkihangouts.android.qa.debug:a679fbc2: onRequestShow at ORIGIN_CLIENT reason SHOW_SOFT_INPUT_BY_INSETS_API fromUser false
2025-05-15 18:01:19.958 22401-22401 InsetsController com.enkihangouts.android.qa.debug D Setting requestedVisibleTypes to -1 (was -9)
2025-05-15 18:01:19.994 22401-22401 AssistStructure com.enkihangouts.android.qa.debug I Flattened final assist data: 772 bytes, containing 1 windows, 4 views
2025-05-15 18:01:20.037 22401-22401 ImeTracker com.enkihangouts.android.qa.debug I com.enkihangouts.android.qa.debug:25b781c4: onRequestShow at ORIGIN_CLIENT reason SHOW_SOFT_INPUT fromUser false
2025-05-15 18:01:20.038 22401-22401 InsetsController com.enkihangouts.android.qa.debug D show(ime(), fromIme=false)
2025-05-15 18:01:20.038 22401-22401 ImeTracker com.enkihangouts.android.qa.debug I com.enkihangouts.android.qa.debug:25b781c4: onCancelled at PHASE_CLIENT_REPORT_REQUESTED_VISIBLE_TYPES
2025-05-15 18:01:20.302 22401-22401 InteractionJankMonitor com.enkihangouts.android.qa.debug W Initializing without READ_DEVICE_CONFIG permission. enabled=false, interval=1, missedFrameThreshold=3, frameTimeThreshold=64, package=com.enkihangouts.android.qa.debug
2025-05-15 18:01:20.392 22401-22401 Autofill Status com.enkihangouts.android.qa.debug D Autofill popup was shown.
2025-05-15 18:01:20.601 22401-22401 ImeTracker com.enkihangouts.android.qa.debug I com.enkihangouts.android.qa.debug:a679fbc2: onShown
2025-05-15 18:01:21.412 22401-22401 Autofill Status com.enkihangouts.android.qa.debug D Autofill popup was hidden.
2025-05-15 18:01:22.666 22401-22401 InsetsController com.enkihangouts.android.qa.debug D show(ime(), fromIme=false)
2025-05-15 18:01:22.667 22401-22401 ImeTracker com.enkihangouts.android.qa.debug I com.enkihangouts.android.qa.debug:ae8f40a1: onRequestShow at ORIGIN_CLIENT reason SHOW_SOFT_INPUT_BY_INSETS_API fromUser false
2025-05-15 18:01:22.667 22401-22401 ImeTracker com.enkihangouts.android.qa.debug I com.enkihangouts.android.qa.debug:ae8f40a1: onCancelled at PHASE_CLIENT_APPLY_ANIMATION
2025-05-15 18:01:22.693 22401-22401 Autofill Status com.enkihangouts.android.qa.debug D Autofill popup was shown.
2025-05-15 18:01:22.727 22401-22401 ImeTracker com.enkihangouts.android.qa.debug I com.enkihangouts.android.qa.debug:f76ac8fa: onRequestShow at ORIGIN_CLIENT reason SHOW_SOFT_INPUT fromUser false
2025-05-15 18:01:22.728 22401-22401 InsetsController com.enkihangouts.android.qa.debug D show(ime(), fromIme=false)
2025-05-15 18:01:22.728 22401-22401 ImeTracker com.enkihangouts.android.qa.debug I com.enkihangouts.android.qa.debug:f76ac8fa: onCancelled at PHASE_CLIENT_APPLY_ANIMATION
2025-05-15 18:01:23.530 22401-22401 Autofill Status com.enkihangouts.android.qa.debug D Autofill popup was hidden.
2025-05-15 18:01:24.922 22401-22401 ImeTracker com.enkihangouts.android.qa.debug I com.enkihangouts.android.qa.debug:171d760e: onRequestHide at ORIGIN_CLIENT reason HIDE_SOFT_INPUT_REQUEST_HIDE_WITH_CONTROL fromUser true
2025-05-15 18:01:24.924 22401-22401 WindowOnBackDispatcher com.enkihangouts.android.qa.debug W sendCancelIfRunning: isInProgress=false callback=android.view.ImeBackAnimationController@d10a0a7
2025-05-15 18:01:24.926 22401-22401 InsetsController com.enkihangouts.android.qa.debug D hide(ime(), fromIme=false)
2025-05-15 18:01:24.926 22401-22401 InsetsController com.enkihangouts.android.qa.debug D Setting requestedVisibleTypes to -9 (was -1)
2025-05-15 18:01:25.554 22401-22401 AndroidAuthUiProvider com.enkihangouts.android.qa.debug D Auth createUserWithEmail
2025-05-15 18:01:25.589 22401-22438 StrictMode com.enkihangouts.android.qa.debug D StrictMode policy violation: android.os.strictmode.IncorrectContextUseViolation: WindowManager should be accessed from Activity or other visual Context. Use an Activity or a Context created with Context#createWindowContext(int, Bundle), which are adjusted to the configuration and visual bounds of an area on screen. (Ask Gemini)
at android.os.StrictMode.onIncorrectContextUsed(StrictMode.java:2395)
at android.app.ContextImpl.getSystemService(ContextImpl.java:2312)
at android.content.ContextWrapper.getSystemService(ContextWrapper.java:964)
at com.amplifyframework.auth.cognito.asf.DeviceDataCollector.getDisplay(DeviceDataCollector.kt:81)
at com.amplifyframework.auth.cognito.asf.DeviceDataCollector.collect(DeviceDataCollector.kt:89)
at com.amplifyframework.auth.cognito.asf.ContextDataAggregator.getAggregatedData(ContextDataAggregator.kt:36)
at com.amplifyframework.auth.cognito.asf.UserContextDataProvider.getEncodedContextData(UserContextDataProvider.kt:87)
at com.amplifyframework.auth.cognito.AuthEnvironment.getUserContextData(AuthEnvironment.kt:105)
at com.amplifyframework.auth.cognito.AuthEnvironment$getUserContextData$1.invokeSuspend(Unknown Source:15)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:586)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:829)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:717)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:704)
Caused by: java.lang.IllegalAccessException: Tried to access visual service WindowManager from a non-visual Context:social.meltingpot.MeltingPotApplication@427964
at android.app.ContextImpl.getSystemService(ContextImpl.java:2311)
at android.content.ContextWrapper.getSystemService(ContextWrapper.java:964)
at com.amplifyframework.auth.cognito.asf.DeviceDataCollector.getDisplay(DeviceDataCollector.kt:81)
at com.amplifyframework.auth.cognito.asf.DeviceDataCollector.collect(DeviceDataCollector.kt:89)
at com.amplifyframework.auth.cognito.asf.ContextDataAggregator.getAggregatedData(ContextDataAggregator.kt:36)
at com.amplifyframework.auth.cognito.asf.UserContextDataProvider.getEncodedContextData(UserContextDataProvider.kt:87)
at com.amplifyframework.auth.cognito.AuthEnvironment.getUserContextData(AuthEnvironment.kt:105)
at com.amplifyframework.auth.cognito.AuthEnvironment$getUserContextData$1.invokeSuspend(Unknown Source:15)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:586)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:829)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:717)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:704)
2025-05-15 18:01:25.590 22401-22438 ContextImpl com.enkihangouts.android.qa.debug E Tried to access visual service WindowManager from a non-visual Context:social.meltingpot.MeltingPotApplication@427964 WindowManager should be accessed from Activity or other visual Context. Use an Activity or a Context created with Context#createWindowContext(int, Bundle), which are adjusted to the configuration and visual bounds of an area on screen. (Ask Gemini)
java.lang.IllegalAccessException: Tried to access visual service WindowManager from a non-visual Context:social.meltingpot.MeltingPotApplication@427964
at android.app.ContextImpl.getSystemService(ContextImpl.java:2311)
at android.content.ContextWrapper.getSystemService(ContextWrapper.java:964)
at com.amplifyframework.auth.cognito.asf.DeviceDataCollector.getDisplay(DeviceDataCollector.kt:81)
at com.amplifyframework.auth.cognito.asf.DeviceDataCollector.collect(DeviceDataCollector.kt:89)
at com.amplifyframework.auth.cognito.asf.ContextDataAggregator.getAggregatedData(ContextDataAggregator.kt:36)
at com.amplifyframework.auth.cognito.asf.UserContextDataProvider.getEncodedContextData(UserContextDataProvider.kt:87)
at com.amplifyframework.auth.cognito.AuthEnvironment.getUserContextData(AuthEnvironment.kt:105)
at com.amplifyframework.auth.cognito.AuthEnvironment$getUserContextData$1.invokeSuspend(Unknown Source:15)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:586)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:829)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:717)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:704)
2025-05-15 18:01:25.650 22401-22401 InsetsController com.enkihangouts.android.qa.debug D hide(ime(), fromIme=false)
2025-05-15 18:01:25.651 22401-22401 ImeTracker com.enkihangouts.android.qa.debug I com.enkihangouts.android.qa.debug:55ee28c7: onRequestHide at ORIGIN_CLIENT reason HIDE_SOFT_INPUT_BY_INSETS_API fromUser false
2025-05-15 18:01:25.651 22401-22401 ImeTracker com.enkihangouts.android.qa.debug I com.enkihangouts.android.qa.debug:55ee28c7: onCancelled at PHASE_CLIENT_ALREADY_HIDDEN
2025-05-15 18:01:26.744 22401-22401 AndroidAuthUiProvider com.enkihangouts.android.qa.debug I Auth Email already exist
2025-05-15 18:01:26.750 22401-22401 AndroidAuthUiProvider com.enkihangouts.android.qa.debug E Auth confirmSignIn afterSign up failed (Ask Gemini)
InvalidStateException{message=Auth state is an invalid state, cannot process the request., cause=null, recoverySuggestion=Operation performed is not a valid operation for the current auth state.}
at com.amplifyframework.auth.cognito.RealAWSCognitoAuthPlugin$confirmSignIn$1.invoke(RealAWSCognitoAuthPlugin.kt:404)
at com.amplifyframework.auth.cognito.RealAWSCognitoAuthPlugin$confirmSignIn$1.invoke(RealAWSCognitoAuthPlugin.kt:372)
at com.amplifyframework.statemachine.StateMachine$getCurrentState$1.invokeSuspend(StateMachine.kt:125)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:487)
at java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:307)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)
2025-05-15 18:01:26.751 22401-22401 SignUpPresenter com.enkihangouts.android.qa.debug E Error (Ask Gemini)
InvalidStateException{message=Auth state is an invalid state, cannot process the request., cause=null, recoverySuggestion=Operation performed is not a valid operation for the current auth state.}
at com.amplifyframework.auth.cognito.RealAWSCognitoAuthPlugin$confirmSignIn$1.invoke(RealAWSCognitoAuthPlugin.kt:404)
at com.amplifyframework.auth.cognito.RealAWSCognitoAuthPlugin$confirmSignIn$1.invoke(RealAWSCognitoAuthPlugin.kt:372)
at com.amplifyframework.statemachine.StateMachine$getCurrentState$1.invokeSuspend(StateMachine.kt:125)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:487)
at java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:307)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)
2025-05-15 18:01:27.089 22401-22401 AndroidRuntime com.enkihangouts.android.qa.debug E FATAL EXCEPTION: main (Ask Gemini)
Process: com.enkihangouts.android.qa.debug, PID: 22401
java.lang.IllegalStateException: Unsupported message type: Auth state is an invalid state, cannot process the request.
at social.meltingpot.onboarding.signup.SignUpKt.processMessage(SignUp.kt:506)
at social.meltingpot.onboarding.signup.SignUpKt.SignUp(SignUp.kt:159)
at social.meltingpot.onboarding.signup.SignUpKt.SignUp(SignUp.kt:112)
at social.meltingpot.onboarding.signup.SignUpUiFactory$create$$inlined$ui$1.Content(Ui.kt:97)
at com.slack.circuit.foundation.CircuitContentKt.CircuitContent(CircuitContent.kt:164)
at com.slack.circuit.foundation.CircuitContentKt.CircuitContent$lambda$22(Unknown Source:19)
at com.slack.circuit.foundation.CircuitContentKt.$r8$lambda$zOd3G1bzjf6W-xs2IuRkeo5rINk(Unknown Source:0)
at com.slack.circuit.foundation.CircuitContentKt$$ExternalSyntheticLambda7.invoke(D8$$SyntheticClass:0)
at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:235)
at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2838)
at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:3158)
at androidx.compose.runtime.ComposerImpl.doCompose-aFTiNEg(Composer.kt:3706)
at androidx.compose.runtime.ComposerImpl.recompose-aFTiNEg$runtime_release(Composer.kt:3648)
at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:1002)
at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:1266)
at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:142)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:620)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:591)
at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:39)
at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:108)
at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.android.kt:41)
at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:69)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1564)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1575)
at android.view.Choreographer.doCallbacks(Choreographer.java:1175)
at android.view.Choreographer.doFrame(Choreographer.java:1100)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1549)
at android.os.Handler.handleCallback(Handler.java:991)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:317)
at android.app.ActivityThread.main(ActivityThread.java:8934)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.runtime.PausableMonotonicFrameClock@24ae1cb, androidx.compose.ui.platform.MotionDurationScaleImpl@8b02da8, StandaloneCoroutine{Cancelling}@8dcd0c1, AndroidUiDispatcher@3e5e066]
Configuration File
No response
GraphQL Schema
// Put your schema below this line
Additional information and screenshots
No response
Hi @niqo01. You have to start a sign in via Amplify.Auth.signIn first. There is no signIn in progress which is why you are getting this exception.
To specifically sign in directly with email OTP you can choose the preferredFirstFactor when calling signIn.
Basically, instead of calling val result = auth.confirmSignIn(AuthFactorType.EmailOtp.value) you would do something like this:
val options = AWSCognitoAuthSignInOptions.builder().preferredFirstFactor(AuthFactorType.EMAIL_OTP).build()
val result = Amplify.Auth.signIn(username = email, password = null, options = options)
Assuming the user has Email OTP available as an option, the expected resulting next step would be AuthSignInStep.CONFIRM_SIGN_IN_WITH_OTP. You would then collect the OTP code from the user and call Amplify.Auth.confirmSignIn(otpCode) next as per the documentation.
Reading over the documentation page this information appears to be missing. I apologize for that and I can understand why you would find that confusing! I'll make a note to improve this documentation page.
In the meantime we can use this issue to work through your implementation. Please give the above a try and let us know if that works.
Hello @mattcreaser, thank you for your help and responsiveness.
I tried your suggestion, here the entire function:
override suspend fun createUserWithEmail(firstName: String, email: String): SignUpResult {
logger.d { "Auth createUserWithEmail" }
try {
val result = auth.signUp(
email,
null,
AuthSignUpOptions.builder()
.userAttribute(AuthUserAttributeKey.email(), email)
.userAttribute(AuthUserAttributeKey.givenName(), firstName)
.build(),
)
return if (result.isSignUpComplete) {
logger.i { "Sign up complete" }
SignUpResult.Complete
} else if (result.nextStep.signUpStep == AuthSignUpStep.CONFIRM_SIGN_UP_STEP) {
logger.i { "Sign up complete with next step" }
SignUpResult.ConfirmSignUp
} else {
val error = IllegalStateException("Unknown error, $result")
logger.e(error) { "Sign up failed" }
SignUpResult.Error(error)
}
} catch (e: AuthException) {
return when (e) {
is UsernameExistsException -> {
logger.i { "Auth Email already exist" }
try {
val options = AWSCognitoAuthSignInOptions.builder().preferredFirstFactor(AuthFactorType.EMAIL_OTP).build()
val result = auth.signIn(username = email, password = null, options = options)
if (result.nextStep.signInStep == AuthSignInStep.CONFIRM_SIGN_IN_WITH_OTP) {
logger.d { "Auth already exist need to confirm" }
SignUpResult.AlreadyExistConfirmSignIn
} else {
val e = IllegalStateException("Unknown auth error $result")
logger.e(e) { "Auth confirmSignIn after Sign up failed" }
SignUpResult.Error(e)
}
} catch (e: AuthException) {
logger.e(e) { "Auth confirmSignIn afterSign up failed" }
SignUpResult.Error(e)
}
}
is UnknownException -> {
if (e.cause is HttpException) {
logger.i { "Connectivity issue" }
SignUpResult.ConnectivityIssue
} else {
logger.e(e) { "Sign up failed" }
SignUpResult.Error(e)
}
}
else -> {
logger.e(e) { "Sign up failed" }
SignUpResult.Error(e)
}
}
}
}
However I am now getting:
ValidationException{message=Sign in failed., cause=null, recoverySuggestion=username or password empty}
at com.amplifyframework.auth.cognito.actions.AuthenticationCognitoActions$initiateSignInAction$$inlined$invoke$1.execute(Action.kt:83)
at com.amplifyframework.statemachine.ConcurrentEffectExecutor$execute$1$1.invokeSuspend(ConcurrentEffectExecutor.kt:26)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
Just in case, I also tried:
val options = AWSCognitoAuthSignInOptions.builder().preferredFirstFactor(AuthFactorType.EMAIL_OTP).build()
val result = auth.signIn(username = email, password = "", options = options)
But this time I would get:
Caused by: InvalidParameterException(message=USER_SRP_AUTH is not enabled for the client.,reasonCode=null)
Which I don't want to enable.
@niqo01 Could you share your amplify_outputs.json file?
@tylerjroach sure:
{
"$schema": "https://raw.githubusercontent.com/aws-amplify/amplify-backend/main/packages/client-config/src/client-config-schema/schema_v1.json",
"version": "1",
"auth": {
"user_pool_id": "us-east-1_coKuyMM8u",
"aws_region": "us-east-1",
"user_pool_client_id": "2p04h8i7hjuhrd7fdfu27g8haj",
"identity_pool_id": null,
"mfa_methods": [],
"standard_required_attributes": [
"email"
],
"username_attributes": [
"email"
],
"user_verification_types": [
"email"
],
"mfa_configuration": "NONE",
"password_policy": {
"min_length": 8,
"require_lowercase": true,
"require_numbers": true,
"require_symbols": true,
"require_uppercase": true
},
"unauthenticated_identities_enabled": true
}
}
@niqo01
I see that you are getting an exception of USER_SRP_AUTH not enabled. I think you missed a builder option for specifying USER_AUTH as the method of authentication. .authFlowType(AuthFlowType.USER_AUTH). So try something like as follows:
val options = AWSCognitoAuthSignInOptions.builder()
.authFlowType(AuthFlowType.USER_AUTH)
.preferredFirstFactor(AuthFactorType.EMAIL_OTP)
.build()
Thanks @harsh62 I got it working.
The fixes were :
1 - Add authFlowType(AuthFlowType.USER_AUTH)
2- Set "" instead of null for password
Meaning:
val result = auth.signIn(username = email, password = null, options = options)
val result = auth.signIn(username = email, password = "", options = options)
@niqo01
Passing in a null for password should be enough. What kind of error or exception do you get if you only added authFlowType(AuthFlowType.USER_AUTH) but pass in a null for password?
@vincetran
ValidationException{message=Sign in failed., cause=null, recoverySuggestion=username or password empty}
Gotcha. Let me investigate something real quick and let me get back to you hopefully by tomorrow on that bit.
Okay so I was able to confirm that passing in a null password should work in my setup. Here's my test code:
try {
val options =
AWSCognitoAuthSignInOptions
.builder()
.authFlowType(AuthFlowType.USER_AUTH)
.preferredFirstFactor(AuthFactorType.EMAIL_OTP)
.build()
val result = Amplify.Auth.signIn(username, options = options)
handleNextSignInStep(username, result.nextStep)
} catch (e: UserNotConfirmedException) {
showError(e)
val codeResult = Amplify.Auth.resendSignUpCode(username)
currentState = PasswordlessState.ConfirmSignUp(username, codeResult)
}
When you set up your Cognito pool, did you set up passwordless manually or did you do what's laid out in the documentation?
This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.