Help With StartMatchmaking (400) Error

I’m using flexmatch to connect players for my game in unity. My ruleset, which is on us-west-2, is basically the same as one of the examples, and as follows (called defaultRuleSet).

"name": "free-for-all",
"ruleLanguageVersion": "1.0",
"playerAttributes": [{
    "name": "skill",
    "type": "number"
"algorithm": {
    "balancedAttribute": "skill",
    "strategy": "balanced",
    "batchingPreference": "largestPopulation"
"teams": [{
    "name": "players",
    "maxPlayers": 200,
    "minPlayers": 30
"rules": [{
    "name": "low-latency",
    "description": "Sets maximum acceptable latency",
    "type": "latency",
    "maxLatency": 150
"expansions": [{
    "target": "rules[low-latency].maxLatency",
    "steps": [{
        "waitTimeSeconds": 12,
        "value": 200
    "target": "teams[players].minPlayers",
    "steps": [{
        "waitTimeSeconds": 10,
        "value": 20
    }, {
        "waitTimeSeconds": 15,
        "value": 10
    }, {
        "waitTimeSeconds": 20,
        "value": 5

When I attempt to start matchmaking, I get a 400 error. My code is as follows:

public void startMatchMaking()
        ticketId = Guid.NewGuid().ToString();
        inMatchMaking = false;

        AttributeValue skill = new AttributeValue
            N = 1.0

        Player player = new Player
            PlayerId = playerId, //already defined, guid
            LatencyInMs = new Dictionary<string, int>{
                { "us-west-2" , 1 }
            PlayerAttributes = new Dictionary<string, AttributeValue>
                { "skill", skill }

        Debug.Log("Player prepared");
            var mmRequest = new StartMatchmakingRequest();
            mmRequest.Players = new List<Player> { player };
            mmRequest.TicketId = ticketId;
            mmRequest.ConfigurationName = "defaultRuleSet";

//algc defined earlier as aglc = new AmazonGameLiftClient(credentials, config);
            StartMatchmakingResponse mmResponse = aglc.StartMatchmaking(mmRequest);

            inMatchMaking = true;
        catch (InvalidRequestException e)
            Debug.Log(e.StatusCode.ToString() + " :( startMatchMaking FAILED. InvalidRequestException " + e.Message);


Am I missing something obvious? What about this request is wrong? Would appreciate help figuring this out. I thought maybe I had to use the internal name (free-for-all), but ding that does not prevent the error.


Whats the error message you get back?

StartMatchmaking will throw a 400 (according to docs) because:


    One or more parameter values in the request are invalid. Correct the invalid parameter values before retrying.

    HTTP Status Code: 400

    A service resource associated with the request could not be found. Clients should not retry such requests.

    HTTP Status Code: 400

    The requested operation is not supported in the Region specified.

    HTTP Status Code: 400

I would try the obvious:

  • Ensure your request is going to us-west-2 and not a us-east-1 (ie did you set the region in config?)
  • Ensure your matchmaker rule set is actually called defaultRuleSet
  • Ensure your credentials have permission to call StartMatchmaking

Knowing actual error will really help track this down.

Just noticed you are catching an InvalidRequestException so it means your passed parameters are wrong.

What does your line Debug.Log(e.StatusCode.ToString() + " :( startMatchMaking FAILED. InvalidRequestException " + e.Message); print?

Thanks for the help, I found a line I had missed in the logged error which specified that the configuration was wrong - I’d been using the ruleset name and not the config name. Silly of me - working now, thanks.

1 Like