Problem with Seamless Travel: "Package is not a level, with a NULL UWorld" (UE 5.1.1)

Hello everyone.

I’m getting a strange bug on my multiplayer game when using seamless travel.
At times, everything works fine, but other times, I get this message in the server logs, and I am not able to do seamless travel from the server:

[2023.08.01-16.32.23:613][503]LogStreaming: Warning: Detected 75016 objects loaded in PostLoad while streaming, this may cause hitches as we’re blocking async loading to pre-load them.
[2023.08.01-16.32.24:257][522]LogWorld: Error: Unable to travel to ‘/Game/MainMap’ - package is not a level
[2023.08.01-16.32.24:257][522]LogWorld: ----SeamlessTravel is cancelled!------
[2023.08.01-16.32.24:257][522]LogNet: Error: TravelFailure: NoLevel, Reason for Failure: ‘Unable to travel to ‘/Game/MainMap’ - package is not a level’ with a NULL UWorld

I checked if my maps are correctly named everywhere, and it seems to be the case. Also, the fact that the error is intermittent tells me that there may be a bug somewhere.
What is going on here?

Note that my map is quite large, so not sure if that is relevant.

Bumping this. Need help!

We just had a similar issue in our game, but we are on UE 4.27.1. I do not know if the issue is the same, but I thought I would share our findings.

In our case we started getting the ‘package is not a level’ error, but it was only happening in a Test build. In a Development build it never happened, but at the same time we started getting errors with the garbage collection. The garbage collection errors are fatal in a Development build, but in a Test build the game doesn’t check for them.

So, our Test build would have a garbage collection fault and then leave a world pointer dangling. Then when the game next attempted to load that same level, the game would get the ‘package is not a level’.

Once we fixed our actors to clean up correctly with the garbage collection, that stopped the world pointers dangling and we no longer got the ‘package is not a level’ error.

So maybe you have a world pointer dangling somewhere?

That’s interesting with the garbage collection. Was the ‘package is not a level’ error happening consistently, or was it intermittent?

The bug looked intermittent, but when we looked at the logs, we noticed that it never happened the first time the level was loaded.

Our garbage collection bug did not always occur, the player had to be doing a particular action at the time to trigger the error. So, unless the player just happened to put the actor into a state where it would not get cleaned up by the garbage collection the bug didn’t occur. Then when the bug did occur it was due to the player doing that particular action during the last playthrough on that level.

Other than the ‘package is not a level’ error there was no real clue as to what was going wrong. We were lucky to spot the correlation to the garbage collection. We just coincidentally had the garbage collection bug at the same time and took a hunch that they were related.

Aha I see. So in your case, you were already in the world, and the bug was triggered by an actor’s action.
In my case, I haven’t even entered the world yet. The bug happens during seamless travel to the world. Very strange.

Just to be clear, the garbage collection error is reported from UEngine::VerifyLoadMapWorldCleanup which occurs when leaving a level. Then the ‘package is not a level’ error happens when next loading that same level.

So, the steps were:

  1. Server travel to the level
  2. Player does something to put an actor into a state where it will not be cleaned up by the garbage collection on the client.
  3. Server travel to another level → world pointer now dangling as the garbage collection has failed.
  4. Server travel back to original level → gives the error ‘package is not a level’

We confirmed the bug by enabling UEngine::VerifyLoadMapWorldCleanup on a Test build and changing the fatal error to be just an error. Then when leaving a level if we got the log along the lines of:
‘Previously active world xxx not cleaned up by garbage collection! Referenced by: xxx’

Then we would get a log like the following when server traveling back to the level:
‘Unable to travel to xxx - package is not a level’

Understood.
In my case, these are the steps:

  1. Player is in main menu (client only)
  2. Player clicks on “Play”
  3. Server gets notified that game session has started
  4. Server travel to the main level
  5. ‘Package is not a level’ error occurs
  6. Client fails to travel to the server map, and stays in the main menu

Another piece of information is that I wasn’t seeing this error when I was using UE 5.0.3. It’s only when I upgraded to UE 5.1.1 that I started seeing it.