Weird Issue on CreateVehicle - Entity 65534

Hello guys,

I’ve developed a persistant car system which spawns cars and restores them if there were 0 players online since they disappear if no player is online and the server loses track of them.

Anyways - spawning the vehicle using the exactly same function works after Server restart.

int handle = CreateVehicle(hash, x_s, y_s, z_s, heading_s, true, true);

I for sure also wait if DoesEntityExist returns true to proceed.

The Vehicle spawns well - like it is supposed to be.
Anyways - If i log out ( im most likely alone on my dev Server ) and i log back in, everything gets called properly ( with a 10s delay ). So if the first player is spawned, my code will respawn every vehicle which was spawned before using exactly the same function stated above.

The values are properly set, the hash is okay - everything is okay BUT my FiveM Server crashes with a pretty weird error:

InvokeNative: execution failed: Tried to access invalid entity: 65534
Unhandled exception: System.InvalidOperationException: Tried to access invalid entity: 65534

  at CitizenFX.Core.ScriptContext.InvokeInternal (CitizenFX.Core.fxScriptContext* cxt, System.UInt64 nativeIdentifier, CitizenFX.Core.IScriptHost scriptHost) [0x00025] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client\clrcore\ScriptContext.cs:358 

  at CitizenFX.Core.ScriptContext.Invoke (CitizenFX.Core.fxScriptContext* cxt, System.UInt64 nativeIdentifier) [0x00000] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client\clrcore\ScriptContext.cs:322 

InvokeNative: execution failed: Tried to access invalid entity: 65534
The Entity throwing this error is alltimes 65534. First i though it could be a short datatype limitation but im not sure about that.

I did alot of testing and uncommenting code but the issue really occours at:
int handle = CreateVehicle(hash, x_s, y_s, z_s, heading_s, true, true);

If i logout without a vehicle was spawned before and log back in, no error is shown and no crash happens.

I really can’t figure out what the problem is. Also this static 65534 Entity Handle is pretty confusing.

Someone have a idear?
Thanks in advance.