# 30:err\_invalid\_handle

**URL:** <https://qa.fmod.com/t/30-err-invalid-handle/19227>\
**Category:** Unity\
**Tags:** android, unity, csharp\
**Created:** [September 1, 2022, 3:13pm UTC](https://qa.fmod.com/t/30-err-invalid-handle/19227 "2022-09-01T15:13:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gorrj](https://avatars.discourse-cdn.com/v4/letter/g/45deac/32.png) [@gorrj](https://qa.fmod.com/u/gorrj)\
**Post date:** [September 1, 2022, 3:13pm UTC](https://qa.fmod.com/t/30-err-invalid-handle/19227/1 "2022-09-01T15:13:44Z")

</div>

Hello. We are encountering:

```auto
[FMOD] AsyncManager::asyncThreadLoop : System::update returned error 30.<br>FMODUnity.RuntimeManager:DEBUG_CALLBACK(DEBUG_FLAGS, IntPtr, Int32, IntPtr, IntPtr)<br><br>
Wed Aug 31 2022 15:11:27 GMT-0400 (Eastern Daylight Time):error19693/19524 Unity

```

when trying to play some “one-shot” events like footsteps (an event with parameters). The exceptions will start happening in place of playing those sound effects. Peculiarly, it is the same set of events that are affected and not a random selection each occurrence. Those sounds will not play at all. Is there anything apparent about this code that would trigger this? There are some VOIP systems as well that I can post if this couldn’t be the culprit.

\*Note \_cacheOneShots = false.

```auto
public virtual void PlayOneShot(int playerId, string audioEventName, GameObject attachPoint = null,
			Rigidbody attachPointRigidbody = null, Dictionary<string, float> parameterCollection = null)
		{
			if (!IsAudioEnabled) return;
			if (playerId < 0) return;
			if (string.IsNullOrEmpty(audioEventName))
			{
#if UNITY_EDITOR
				SlLogger.LogWarning("Audio event name is not provided.");
#endif
				return;
			}

			//one-shots only allowed this way
			if (!IsOneShotType(audioEventName))
			{
				SlLogger.LogError($"Trying to play streaming audio as one-shot: {audioEventName}");
				return;
			}

			//returns an available pool member or create a new instance
			EventInstance instance;
			bool needsInit = true;
//cache one shots is currently FALSE
			if (_cacheOneShots) instance = GetOneShotEventInstance(playerId, audioEventName, out needsInit);
			else instance = RuntimeManager.CreateInstance(audioEventName);
			//only configure if its a new instance, increases performance by
			//avoiding additional instructions
			if (needsInit)
			{
				if (attachPoint != null) RuntimeManager.AttachInstanceToGameObject(instance, attachPoint.transform, attachPointRigidbody);
				else instance.set3DAttributes(Vector3.zero.To3DAttributes());
			}
			//always apply params
			if (parameterCollection != null)
			{
				foreach (KeyValuePair<string, float> parameter in parameterCollection)
				{
					if (string.IsNullOrEmpty(parameter.Key)) continue;
					instance.setParameterByName(parameter.Key, parameter.Value);
				}
			}
			instance.start();
			//if not cached, we should release this immediately
			if (!_cacheOneShots) instance.release();
		}

		private bool IsOneShotType(string audioEventName)
		{
			//check to see if the event is in our banks
			var eventDescription = RuntimeManager.GetEventDescription(audioEventName);
			if (!eventDescription.isValid()) return false;

			//very important: only play one shot events here this way
			bool isOneShot = false;
			//snapshots should not be played as one-shots
			if (!audioEventName.StartsWith(FmodSnapshotString, StringComparison.CurrentCultureIgnoreCase))
			{
				eventDescription.isOneshot(out isOneShot);
			}
			return isOneShot;
		}

```

---

<div class="post-metadata">

**Author:** ![mathew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mathew/32/431_2.png) [@mathew](https://qa.fmod.com/u/mathew)\
**Post date:** [September 4, 2022, 11:49pm UTC](https://qa.fmod.com/t/30-err-invalid-handle/19227/2 "2022-09-04T23:49:19Z")

</div>

This issue is being addressed via FMOD support email which has more context regarding the user code.

It is believed the issue is being caused by the VOIP implementation and releasing an `FMOD::Sound` before the containing `FMOD::Studio::EventInstance` has stopped. For those interested, please see our [programmer sound example](https://fmod.com/docs/unity/examples-programmer-sounds.html) in the Unity documentation.
