Why is Map<Id, Set<Id>> an unsupported parameter type in future methods?

The list of primitives doesn't include Map, Set, or List. Therefore, what you have is a collection of non-primitives. They've also explicitly excluded Object, so you can't weasel your way around that limitation that way, either. You cannot include any nested collections at all, including things like List<List<String>> or Set<List<String>>, or any other combination of nested collections.

This restriction has to do with how future methods serialize their parameters; it literally cannot support complex data types. It was originally placed on future methods to limit the complexity of serialization, which is why salesforce allowed 50 future calls as opposed to five Batchable calls per transaction.

Since then, we've been given Queueable, which suggests that future should enjoy the same serializing features, but it hasn't been upgraded, and probably won't be for the foreseeable future, because we have a newer feature that gives this this ability already. If you need future-like behavior with complex types, use Queueable instead.


Technically, you are passing in a Collection of a Collection. While semantically, you could argue that this reduces to a Colleciton, this is not how the Apex compiler has chosen to interpret it.

The primitive data types listed here are:

  • Blob
  • Boolean
  • Date
  • Datetime
  • Decimal
  • Double
  • Id
  • Integer
  • Long
  • Object
  • String
  • Time

For the Apex compiler to accept a Map<Id,Set<Id>>, then Set<Id> would need to be one of these, not just Id itself (excepting Object as sfdcfox pointed out).