egametang/ET · error · RpcException

ERR_LocationLockTokenMismatch

ERR_LocationLockTokenMismatch

Error message

location unlock token mismatch type: {locationType} key: {key} oldActorId: {oldActorId} requestToken: {lockToken} holdToken: {state.LockToken}

What it means

GetOneBySceneType throws when the count of StartSceneConfig entries matching a (zone, sceneType) pair is not exactly 1 — i.e. zero or two-or-more. It is the singleton-lookup invariant for callers that expect exactly one scene of a given type per zone, built on top of GetBySceneType which filters by Zone and SceneType name.

Source

Thrown at Packages/cn.etetet.actorlocation/Scripts/Hotfix/Server/LocationComponentSystem.cs:518

                            self.RestoreStates(key, snapshot);
                        }

                        throw;
                    }

                    throw new RpcException(ErrorCode.ERR_LocationLockNotFound,
                        $"location unlock expired type: {locationType} key: {key} oldActorId: {oldActorId}");
                }

                if (!IsLocked(state))
                {
                    throw new RpcException(ErrorCode.ERR_LocationLockNotFound,
                        $"location unlock not found type: {locationType} key: {key} oldActorId: {oldActorId}");
                }

                if (lockToken == 0 || state.LockToken != lockToken)
                {
                    throw new RpcException(ErrorCode.ERR_LocationLockTokenMismatch,
                        $"location unlock token mismatch type: {locationType} key: {key} oldActorId: {oldActorId} requestToken: {lockToken} holdToken: {state.LockToken}");
                }

                if (oldActorId != state.ActorId)
                {
                    throw new RpcException(ErrorCode.ERR_LocationLockOwnerMismatch,
                        $"location unlock old actor mismatch type: {locationType} key: {key} requestOldActorId: {oldActorId} holdActorId: {state.ActorId}");
                }

                Log.Info(
                    $"location unlock type: {locationType} key: {key} actorId: {oldActorId} newActorId: {newActorId} lockToken: {lockToken}");

                state.ActorId = newActorId;
                state.LockToken = default;
                state.LockExpireTime = default;
                locationInfo.TypeStates[locationType] = state;

                try

View on GitHub (pinned to 5cab01f7a8)

Solutions

  1. Inspect the StartSceneConfig table for the given zone+sceneType and ensure exactly one entry exists.
  2. Remove duplicates or add the missing scene definition, then reload configs.
  3. Verify the zone and sceneType values passed are correct (check SceneTypeSingleton.GetSceneName mapping).
  4. If multiple scenes are legitimately valid, switch the caller to GetBySceneType and select explicitly instead of GetOneBySceneType.

Example fix

// before
StartSceneConfig config = category.GetOneBySceneType(zone, sceneType);

// after
List<StartSceneConfig> configs = category.GetBySceneType(zone, sceneType);
if (configs.Count != 1)
{
    Log.Error($"expected exactly 1 scene for zone {zone} sceneType {sceneType}, got {configs.Count}");
    return null;
}
StartSceneConfig config = configs[0];
Defensive patterns

Strategy: validation

Validate before calling

List<StartSceneConfig> configs = category.GetBySceneType(zone, sceneType);
if (configs.Count != 1)
{
    Log.Error($"expected 1 scene for zone {zone} sceneType {sceneType}, found {configs.Count}");
    return null;
}

Try / catch

try
{
    StartSceneConfig cfg = category.GetOneBySceneType(zone, sceneType);
}
catch (Exception ex) when (ex.Message.Contains("scene config count is not one"))
{
    Log.Error($"ambiguous/missing scene config: {ex.Message}");
}

Prevention

When it happens

Trigger: Calling GetOneBySceneType(zone, sceneType) when the StartSceneConfig table has no entry for that zone+sceneType (count 0), or has duplicate/ambiguous entries (count >= 2). SceneType is resolved through SceneTypeSingleton.Instance.GetSceneName, so an unknown enum also yields count 0.

Common situations: StartSceneConfig table missing the scene for that zone; duplicate rows for the same zone+sceneType; wrong zone id passed by the caller; sceneType integer does not map to the expected name via SceneTypeSingleton.

Related errors


AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13). Data as JSON: /api/errors/5d9362745569d0e8. Report an issue: GitHub.