Using system.config to create themes across gateways

I am trying out the new system.config functions to send a custom theme to remote gateways. Here is my project library script and my corresponding message script.

def sendHpHmiTheme(gateways = None):
	if not gateways:
		gateways = getOnlineGateways()
		if not gateways:
			# No gateways are online
			return
	
	# Get resource definition and package it into payload
	res = system.config.getResource(moduleId="com.inductiveautomation.perspective", typeId="themes", name="hp-hmi")
	configData = {
		'name': res.name,
		'collection': res.collection,
		'config': res.config,
		'files': res.files,
		'enabled': res.enabled,
		'attributes': res.attributes
	}
	
	system.util.sendMessage('Datavan', "addTheme", payload = {'configData': configData}, scope="G", remoteServers=gateways)
def handleMessage(payload):
	moduleId="com.inductiveautomation.perspective"
	typeId="themes"
	configData = payload['configData']
	
	try:
		# Check if resource already exists
		res = system.config.getResource(moduleId=moduleId, typeId=typeId, name=configData['name'])
	except ValueError:
		# It does not exist, create it
		system.config.create(moduleId=moduleId, typeId=typeId, **configData)
	else:
		# It does exist, replace it with same signature
		signature = res.signature
		system.config.replace(moduleId=moduleId, typeId=typeId, signature=signature, **configData)

When sending this as a remote message to a gateway without the theme, I get the exception line 11, in handleMessage ValueError: Provide resource config via the config parameter

Strangely, when I try setting the remote gateway as the gateway it is being called from (so a gateway with the theme already existing), I get a different exception: ValueError: java.lang.IllegalStateException: Resource not found: com.inductiveautomation.perspective/themes/hp-hmi

Is this some artifact of trying to do this over a gateway message, or is creating themes through system.config just not fully supported at this time?

Creating themes should definitely be possible via system.config.

Out of curiosity, if you change this line in the broadcast:

Into:
'config': dict(res.config),
Does it behave any differently?

And have you checked via a debug log the exact keys/values/types you're receiving in your message handler?