Unable to update a worker's code

When updating a worker.js via either API or the CF GUI, I get this error:
workers.api.error.malformed_param: must specify either 'script' or 'service' (Code: 10004)
How can I go about resolving this?