# Troubleshooting

Having trouble with multi user support in LootLocker? Here are some common issues and solutions.

## Common Issues

### 1. API calls return data for the wrong user

* **Solution:** Always specify the ULID when making API calls in a multi user context. If you do not, the SDK will use the default user, which may not be what you expect.

### 2. Session not found or invalid

* **Solution:** First make sure that the request is for the expected player and not a previous and expired session. Next ensure the player has been authenticated and their session is active. If you manually manage sessions (e.g., on a server), make sure you have called `StartSessionManual` with the correct data.

### 3. Removing a user does not clear their data

* **Solution:** Use the SDK's end session methods to properly remove a user's session and data. See the [End Sessions and Clean State](https://github.com/lootlocker/gitbook-sync/blob/main/players/multi-user/end-sessions-and-clean-state.md) guide.

### 4. Unexpected default user

* **Solution:** If you switch profiles, remember that the default user changes. Always specify ULID for clarity.

## Debugging

### How to check which is the current default user

To check which player is currently the default player is a simple operation but can be crucial for when you're debugging your game.

{% tabs %}
{% tab title="Unity" %}

```cs
LootLockerSDKManager.GetDefaultPlayerUlid();
```

{% endtab %}

{% tab title="Unreal C++" %}

```cpp
ULootLockerSDKManager::GetDefaultPlayerUlid();
```

{% endtab %}

{% tab title="Unreal Blueprints" %}

<figure><img src="https://534367586-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MVu1MPzezO-NgvC98xh%2Fuploads%2Fgit-blob-b1e7aa579420d26a671f7594db48a4a6f7c2ca82%2Funreal-blueprint-get-default-player.png?alt=media" alt=""><figcaption><p>Blueprint example of getting which is the current default player</p></figcaption></figure>
{% endtab %}
{% endtabs %}

### How to check which player a request was executed for

To check which player a request (any LootLocker request) was executed for is a simple operation but can be crucial for you when you're debugging your game. The below example shows how to get this data from the response to getting progression data. But all responses to all LootLocker methods holds this crucial context object which contains the player ulid the request was executed for.

{% tabs %}
{% tab title="Unity" %}

```cs
var progression_key = "replace_with_your_key";
var executeRequestForPlayerWithUlid = "replace_with_your_player_ulid";
LootLockerSDKManager.GetProgression(progression_key, response =>
{
    if (!response.success)
    {
        Debug.LogWarning($"Getting progression data for {progression_key} failed: {response.errorData}"
            + $"\n request was executed for player with ulid {response.requestContext.player_ulid}"
            + $" and was expected to be executed for player with ulid {executeRequestForPlayerWithUlid}");
    }
}, executeRequestForPlayerWithUlid);
```

{% endtab %}

{% tab title="Unreal C++" %}

```cpp
FString progression_key = "replace_with_your_key";
FString executeRequestForPlayerWithUlid = "replace_with_your_player_ulid";
ULootLockerSDKManager::GetProgression(progression_key, FLootLockerProgressionResponseDelegate::CreateLambda([=](const FLootLockerProgressionResponse& response)
{
    if (!response.success)
    {
        UE_LOG(LogWorkingProject, Warning, TEXT("Getting progression data for %s failed: %s"), *progression_key, *response.errorData);
        UE_LOG(LogWorkingProject, Warning, TEXT("Request was executed for player with ulid %s"), *response.requestContext.player_ulid);
        UE_LOG(LogWorkingProject, Warning, TEXT("And was expected to be executed for player with ulid %s"), *executeRequestForPlayerWithUlid);
    }
}), executeRequestForPlayerWithUlid);
```

{% endtab %}

{% tab title="Unreal Blueprints" %}

<figure><img src="https://534367586-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MVu1MPzezO-NgvC98xh%2Fuploads%2Fgit-blob-70928a75899777145c0546a1b72bb25edb7003c8%2Funreal-blueprint-debug-execution-context.png?alt=media" alt=""><figcaption><p><a href="https://blueprintue.com/blueprint/scpcq1n-/">Blueprint example of how to debug execution context</a></p></figcaption></figure>
{% endtab %}
{% endtabs %}

## Best Practices

* Always specify ULID in multi user scenarios.
* Clean up sessions for users who log out or leave, unless you know that you want to keep them for added functionality like profile switching.
* In server contexts, manage session tokens and player data carefully.

## Need More Help?

If you encounter issues not covered here, reach out in our [community Discord](https://discord.lootlocker.io).
