Changing the category for existing Gutenberg blocks

Try this, it changes the core Spacer block from the Design to the Media category in the insertor:

function myprefixFilterSpacerCategory(settings, name) {
  if (name === "core/spacer") {
    // Object.assign can also be used instead of lodash.assign
    return lodash.assign({}, settings, {
      category: "media",
    });
  }
  return settings;
}

wp.hooks.addFilter(
  "blocks.registerBlockType",
  "myprefix/filter-spacer-category",
  myprefixFilterSpacerCategory
);

error code: 523