Attempting to use an invalid operation handle

In my project, without any change on anything related to localization, all of a sudden, the development builds started to show this error. No LocalizeString is marked Wait For Completion. Ans is not reproducible in the Editor. Any idea?

Exception: Attempting to use an invalid operation handle
at UnityEngine.ResourceManagement.AsyncOperations.GroupOperation.CompleteIfDependenciesComplete () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.ResourceManagement.AsyncOperations.GroupOperation.InvokeWaitForCompletion () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase1[TObject].WaitForCompletion () [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.WaitForCompletion () [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.Localization.WaitForCurrentOperationAsyncOperationBase1[TObject].InvokeWaitForCompletion () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase1[TObject].WaitForCompletion () [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.WaitForCompletion () [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.ResourceManagement.AsyncOperations.GroupOperation.InvokeWaitForCompletion () [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase1[TObject].WaitForCompletion () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.WaitForCompletion () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.Localization.WaitForCurrentOperationAsyncOperationBase1[TObject].InvokeWaitForCompletion () [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase1[TObject].WaitForCompletion () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.WaitForCompletion () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.Localization.WaitForCurrentOperationAsyncOperationBase1[TObject].InvokeWaitForCompletion () [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase1[TObject].WaitForCompletion () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.WaitForCompletion () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.Localization.WaitForCurrentOperationAsyncOperationBase1[TObject].InvokeWaitForCompletion () [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase1[TObject].WaitForCompletion () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.WaitForCompletion () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.Localization.WaitForCurrentOperationAsyncOperationBase1[TObject].InvokeWaitForCompletion () [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase1[TObject].WaitForCompletion () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1[TObject].WaitForCompletion () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.Localization.LocalizedString.GetLocalizedString () [0x00000] in <00000000000000000000000000000000>:0

What version are you using? We have fixes for this in 1.4.2

1 Like

I’m using 1.3.2. It is the latest it allows me to have with 2021.3 LTS

How can I install the 1.4.2? It doesn’t appear as an option in the Package Manager

You can upgrade by either selecting the show all versions option in the package manager or manually editing the manifest.json file in the project Packages folder.

I did it by modifying the manifest.json. But out of curiosity, where do I select to see all versions in the package manager? I can’t find such an option.

Thanks

You may need to enable the show pre release option in the package manager options

Did 1.4.2 fix your issues?

Sadly, it did not. Now it seems to raise a slightly different one but also related to the LocalizedString.

OperationException : Expected to have a current operation to wait on. Can not complete.
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[ ])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogError(Object)
UnityEngine.AddressableAssets.AddressablesImpl:LogException(AsyncOperationHandle, Exception) (at C:\UnityProjects\Drone\Library\PackageCache\com.unity.addressables@1.20.5\Runtime\AddressablesImpl.cs:219)
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase1:set_OperationException(Exception) (at C:\UnityProjects\Drone\Library\PackageCache\com.unity.addressables@1.20.5\Runtime\ResourceManager\AsyncOperations\AsyncOperationBase.cs:348) UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase1:Complete(Object, Boolean, Exception, Boolean) (at C:\UnityProjects\Drone\Library\PackageCache\com.unity.addressables@1.20.5\Runtime\ResourceManager\AsyncOperations\AsyncOperationBase.cs:488)
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase1:Complete(Object, Boolean, String, Boolean) (at C:\UnityProjects\Drone\Library\PackageCache\com.unity.addressables@1.20.5\Runtime\ResourceManager\AsyncOperations\AsyncOperationBase.cs:451) UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase1:Complete(Object, Boolean, String) (at C:\UnityProjects\Drone\Library\PackageCache\com.unity.addressables@1.20.5\Runtime\ResourceManager\AsyncOperations\AsyncOperationBase.cs:435)
UnityEngine.Localization.Operations.WaitForCurrentOperationAsyncOperationBase1:InvokeWaitForCompletion() (at C:\UnityProjects\Drone\Library\PackageCache\com.unity.localization@1.4.2\Runtime\Operations\WaitForCurrentOperationAsyncOperationBase.cs:40) UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase1:WaitForCompletion() (at C:\UnityProjects\Drone\Library\PackageCache\com.unity.addressables@1.20.5\Runtime\ResourceManager\AsyncOperations\AsyncOperationBase.cs:172)
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle:WaitForCompletion() (at C:\UnityProjects\Drone\Library\PackageCache\com.unity.addressables@1.20.5\Runtime\ResourceManager\AsyncOperations\AsyncOperationHandle.cs:602)
UnityEngine.Localization.Operations.WaitForCurrentOperationAsyncOperationBase1:InvokeWaitForCompletion() (at C:\UnityProjects\Drone\Library\PackageCache\com.unity.localization@1.4.2\Runtime\Operations\WaitForCurrentOperationAsyncOperationBase.cs:32) UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase1:WaitForCompletion() (at C:\UnityProjects\Drone\Library\PackageCache\com.unity.addressables@1.20.5\Runtime\ResourceManager\AsyncOperations\AsyncOperationBase.cs:172)
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle:WaitForCompletion() (at C:\UnityProjects\Drone\Library\PackageCache\com.unity.addressables@1.20.5\Runtime\ResourceManager\AsyncOperations\AsyncOperationHandle.cs:602)
UnityEngine.Localization.Operations.WaitForCurrentOperationAsyncOperationBase1:InvokeWaitForCompletion() (at C:\UnityProjects\Drone\Library\PackageCache\com.unity.localization@1.4.2\Runtime\Operations\WaitForCurrentOperationAsyncOperationBase.cs:32) UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase1:WaitForCompletion() (at C:\UnityProjects\Drone\Library\PackageCache\com.unity.addressables@1.20.5\Runtime\ResourceManager\AsyncOperations\AsyncOperationBase.cs:172)
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle:WaitForCompletion() (at C:\UnityProjects\Drone\Library\PackageCache\com.unity.addressables@1.20.5\Runtime\ResourceManager\AsyncOperations\AsyncOperationHandle.cs:602)
UnityEngine.Localization.Operations.WaitForCurrentOperationAsyncOperationBase1:InvokeWaitForCompletion() (at C:\UnityProjects\Drone\Library\PackageCache\com.unity.localization@1.4.2\Runtime\Operations\WaitForCurrentOperationAsyncOperationBase.cs:32) UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase1:WaitForCompletion() (at C:\UnityProjects\Drone\Library\PackageCache\com.unity.addressables@1.20.5\Runtime\ResourceManager\AsyncOperations\AsyncOperationBase.cs:172)
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1:WaitForCompletion() (at C:\UnityProjects\Drone\Library\PackageCache\com.unity.addressables@1.20.5\Runtime\ResourceManager\AsyncOperations\AsyncOperationHandle.cs:199)
UnityEngine.Localization.LocalizedString:GetLocalizedString() (at C:\UnityProjects\Drone\Library\PackageCache\com.unity.localization@1.4.2\Runtime\Localized Reference\LocalizedString.cs:273)

That looks like a bug. Could you please file a bug report?

I will. Is there a way I can get around this issue for now?

Try enabling preload on the string tables. If that does not work then try using LocalizedString:GetLocalizedStringAsync instead of LocalizedString:GetLocalizedString.

I already had all tables set to Preload. But changing the methods to the Async version seems to be working fine so far.
Thanks!

1 Like

Hi, I also got this issue when a game object containing LocalizeStringEvent appears for the first time. All my LocalizeStringEvent components are not set to Wait for Completion & preloading all tables doesn’t help. Any workarounds?

Could you please file a bug report?

Can confirm:

  • bumping from 1.0.5 to 1.3.2 will start to throw “Exception: Attempting to use an invalid operation handle”
  • bumping from 1.3.2 to 1.4.2 resolves the issue. No exception any more.

on Unity 2021.3.27.

For future devs who went here (since this is highest google result when you search localization invalid operation handle), they removed the “show all package” option from package manager since 2021. So to get 1.4.2 you have to edit your manifest.json mannually.

Small Nit: why is 1.4.2 not available in package manager even in 2021 LTS. Even 1.4.4 is made for 2019 and above.
1.3.2 is the highest upgradable version in 2021LTS package manager and it has this addressable bug.

1 Like

Hi,
Can you tell me which version are you talking about?

The latest version is now 1.4.4. It may not be visible in the package manager, if not you can upgrade by editing the manifest.json file in the projects Package folder. Open the json and look for the com.unity.localization line and change the version to 1.4.4

Thanks

Hi folks, what is the status of this bug and do you have a link to the bug tracker?
I’m experiencing this issue with:

  • Unity 2021.3.11f1
  • Localization package v1.4.5
  • Addressables package v1.21.18

The issue only occurs in a standalone build, not in editor.

I get this error when I call UnityEngine.Localization.Settings.LocalizationSettings.InitializationOperation.WaitForCompletion()

I am loading a scene additively and async when my game starts, which contains a bunch of manager scripts, and the above line of code is called in Awake() on the first script to execute in that scene. I’m using an
AsyncOperation to track the scene load progress too.

Am I doing something wrong here? This post states that “using WaitForCompletion can have issues (Scenes must be async)” but I’m not really sure what that means. Can anyone help please?

Hi,
There’s no single cause for this error message. All bugs related to it have been fixed in 1.4.5 so this must be something new that we are not aware of. We would need a bug report so we can investigate and understand what is causing it in your project Unity QA: Building quality with passion

A workaround would be to avoid calling WaitForCompletion and instead wait for the Completed event to be fired.
Alternatively, you could try setting Initialize Synchronously in the localization settings, this calls WaitForCompletion for you so it may cause the same issue.