How do i add search attributes with the PHP SDK?

I created a OperatorServiceClient and can read existing attributes just fine but when I try to create some I get a Bad metadata value given. Here’s the code:

[$response] = $client->listSearchAttributes((new ListSearchAttributesRequest()->setNamespace('default')))->wait();
assert($response instanceof ListSearchAttributesResponse);
$desired = [
  'JobProgress' => IndexedValueType::INDEXED_VALUE_TYPE_INT,
  'JobTotal'    => IndexedValueType::INDEXED_VALUE_TYPE_INT,
  'JobStatus'   => IndexedValueType::INDEXED_VALUE_TYPE_TEXT,
];
if ($missing = array_diff_key($desired, iterator_to_array($response->getCustomAttributes()))) {
  $client->addSearchAttributes(new AddSearchAttributesRequest()->setNamespace('default'), $missing);
}

It’s

$client->addSearchAttributes(
  new AddSearchAttributesRequest()
    ->setNamespace($namespace)
    ->setSearchAttributes($missing)
)->wait();