#84142 is introducing an assertion which verifies that the cluster state we write to disk can be loaded again. This build failure shows that this assertion currently does not hold due to an undeclared field called `task_name`.

NB doesn't fail on `master` directly you need to check the PR branch, but it represents a genuine bug on `master`: if a node crashed after writing this state then it would not be able to restart.

**Build scan:**
https://gradle-enterprise.elastic.co/s/zne65f5ti7kfo/tests/:x-pack:plugin:shutdown:internalClusterTest/org.elasticsearch.xpack.shutdown.NodeShutdownTasksIT/testTasksAreNotAssignedToShuttingDownNode

**Reproduction line:**
`./gradlew ':x-pack:plugin:shutdown:internalClusterTest' --tests "org.elasticsearch.xpack.shutdown.NodeShutdownTasksIT.testTasksAreNotAssignedToShuttingDownNode" -Dtests.seed=E2D8712A01541857 -Dtests.locale=es-PY -Dtests.timezone=Africa/Kinshasa -Druntime.java=17`

**Applicable branches:**
~master~ https://github.com/elastic/elasticsearch/pull/84142/commits/3eb6089edb1ead5e33f4a081c4b5a2719d9c4217

**Reproduces locally?:**
Yes

**Failure history:**
https://gradle-enterprise.elastic.co/scans/tests?tests.container=org.elasticsearch.xpack.shutdown.NodeShutdownTasksIT&tests.test=testTasksAreNotAssignedToShuttingDownNode

**Failure excerpt:**

<details>
<summary>Expand for stack trace</summary>

```
WARNING: Uncaught exception in thread: Thread[elasticsearch[node_t0][cluster_coordination][T#1],5,TGRP-NodeShutdownTasksIT] |  
-- | --
  | java.lang.AssertionError: org.elasticsearch.gateway.CorruptStateException: org.elasticsearch.xcontent.XContentParseException: [-1:358] [persistent_tasks] failed to parse field [tasks] |  
  | at __randomizedtesting.SeedInfo.seed([E2D8712A01541857]:0) |  
  | at org.elasticsearch.gateway.PersistedClusterStateService$Writer.assertOnCommit(PersistedClusterStateService.java:1020) |  
  | at org.elasticsearch.gateway.PersistedClusterStateService$Writer.commit(PersistedClusterStateService.java:1007) |  
  | at org.elasticsearch.gateway.PersistedClusterStateService$Writer.writeIncrementalStateAndCommit(PersistedClusterStateService.java:823) |  
  | at org.elasticsearch.gateway.GatewayMetaState$LucenePersistedState.setLastAcceptedState(GatewayMetaState.java:507) |  
  | at org.elasticsearch.cluster.coordination.CoordinationState.handlePublishRequest(CoordinationState.java:392) |  
  | at org.elasticsearch.cluster.coordination.Coordinator.handlePublishRequest(Coordinator.java:418) |  
  | at org.elasticsearch.cluster.coordination.PublicationTransportHandler.acceptState(PublicationTransportHandler.java:200) |  
  | at org.elasticsearch.cluster.coordination.PublicationTransportHandler.handleIncomingPublishRequest(PublicationTransportHandler.java:183) |  
  | at org.elasticsearch.cluster.coordination.PublicationTransportHandler.lambda$new$0(PublicationTransportHandler.java:103) |  
  | at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:67) |  
  | at org.elasticsearch.transport.TransportService$6.doRun(TransportService.java:917) |  
  | at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:776) |  
  | at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26) |  
  | at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) |  
  | at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) |  
  | at java.base/java.lang.Thread.run(Thread.java:833) |  
  | Caused by: org.elasticsearch.gateway.CorruptStateException: org.elasticsearch.xcontent.XContentParseException: [-1:358] [persistent_tasks] failed to parse field [tasks] |  
  | at org.elasticsearch.gateway.PersistedClusterStateService.readXContent(PersistedClusterStateService.java:539) |  
  | at org.elasticsearch.gateway.PersistedClusterStateService.lambda$loadOnDiskState$2(PersistedClusterStateService.java:493) |  
  | at org.elasticsearch.gateway.PersistedClusterStateService.consumeFromType(PersistedClusterStateService.java:580) |  
  | at org.elasticsearch.gateway.PersistedClusterStateService.loadOnDiskState(PersistedClusterStateService.java:492) |  
  | at org.elasticsearch.gateway.PersistedClusterStateService$Writer.assertOnCommit(PersistedClusterStateService.java:1016) |  
  | ... 15 more |  
  | Caused by: org.elasticsearch.xcontent.XContentParseException: [-1:358] [persistent_tasks] failed to parse field [tasks] |  
  | at org.elasticsearch.xcontent.ObjectParser.throwFailedToParse(ObjectParser.java:626) |  
  | at org.elasticsearch.xcontent.ObjectParser.parseValue(ObjectParser.java:621) |  
  | at org.elasticsearch.xcontent.ObjectParser.parseArray(ObjectParser.java:614) |  
  | at org.elasticsearch.xcontent.ObjectParser.parseSub(ObjectParser.java:647) |  
  | at org.elasticsearch.xcontent.ObjectParser.parse(ObjectParser.java:319) |  
  | at org.elasticsearch.xcontent.ObjectParser.parse(ObjectParser.java:258) |  
  | at org.elasticsearch.xcontent.ObjectParser.apply(ObjectParser.java:392) |  
  | at org.elasticsearch.persistent.PersistentTasksCustomMetadata.fromXContent(PersistentTasksCustomMetadata.java:208) |  
  | at org.elasticsearch.xcontent.NamedXContentRegistry$Entry.lambda$new$0(NamedXContentRegistry.java:54) |  
  | at org.elasticsearch.xcontent.NamedXContentRegistry.parseNamedObject(NamedXContentRegistry.java:147) |  
  | at org.elasticsearch.xcontent.support.AbstractXContentParser.namedObject(AbstractXContentParser.java:416) |  
  | at org.elasticsearch.cluster.metadata.Metadata$Builder.fromXContent(Metadata.java:2188) |  
  | at org.elasticsearch.gateway.PersistedClusterStateService.readXContent(PersistedClusterStateService.java:537) |  
  | ... 19 more |  
  | Caused by: org.elasticsearch.xcontent.XContentParseException: [-1:358] [tasks] failed to parse field [task] |  
  | at org.elasticsearch.xcontent.ObjectParser.throwFailedToParse(ObjectParser.java:626) |  
  | at org.elasticsearch.xcontent.ObjectParser.parseValue(ObjectParser.java:621) |  
  | at org.elasticsearch.xcontent.ObjectParser.parseSub(ObjectParser.java:633) |  
  | at org.elasticsearch.xcontent.ObjectParser.parse(ObjectParser.java:319) |  
  | at org.elasticsearch.xcontent.ObjectParser.parse(ObjectParser.java:258) |  
  | at org.elasticsearch.xcontent.AbstractObjectParser.lambda$declareFieldArray$20(AbstractObjectParser.java:336) |  
  | at org.elasticsearch.xcontent.AbstractObjectParser.parseArray(AbstractObjectParser.java:418) |  
  | at org.elasticsearch.xcontent.AbstractObjectParser.lambda$declareFieldArray$21(AbstractObjectParser.java:336) |  
  | at org.elasticsearch.xcontent.ObjectParser.lambda$declareField$10(ObjectParser.java:441) |  
  | at org.elasticsearch.xcontent.ObjectParser.parseValue(ObjectParser.java:619) |  
  | ... 30 more |  
  | Caused by: org.elasticsearch.xcontent.XContentParseException: [-1:358] [task] failed to parse field [task_name] |  
  | at org.elasticsearch.xcontent.ObjectParser.rethrowFieldParseFailure(ObjectParser.java:564) |  
  | at org.elasticsearch.xcontent.ObjectParser.lambda$declareNamedObjects$14(ObjectParser.java:504) |  
  | at org.elasticsearch.xcontent.ObjectParser.lambda$declareNamedObjects$15(ObjectParser.java:515) |  
  | at org.elasticsearch.xcontent.ObjectParser.parseValue(ObjectParser.java:619) |  
  | ... 38 more |  
  | Caused by: org.elasticsearch.xcontent.XContentParseException: [-1:358] [named] failed to parse field [params] |  
  | at org.elasticsearch.xcontent.ObjectParser.throwFailedToParse(ObjectParser.java:626) |  
  | at org.elasticsearch.xcontent.ObjectParser.parseValue(ObjectParser.java:621) |  
  | at org.elasticsearch.xcontent.ObjectParser.parseSub(ObjectParser.java:633) |  
  | at org.elasticsearch.xcontent.ObjectParser.parse(ObjectParser.java:319) |  
  | at org.elasticsearch.persistent.PersistentTasksCustomMetadata.lambda$static$3(PersistentTasksCustomMetadata.java:97) |  
  | at org.elasticsearch.xcontent.ObjectParser.lambda$declareNamedObjects$14(ObjectParser.java:502) |  
  | ... 40 more |  
  | Caused by: org.elasticsearch.xcontent.NamedObjectNotFoundException: [-1:358] unknown field [task_name] |  
  | at org.elasticsearch.xcontent.NamedXContentRegistry.lookupParser(NamedXContentRegistry.java:162) |  
  | at org.elasticsearch.xcontent.NamedXContentRegistry.parseNamedObject(NamedXContentRegistry.java:146) |  
  | at org.elasticsearch.xcontent.support.AbstractXContentParser.namedObject(AbstractXContentParser.java:416) |  
  | at org.elasticsearch.persistent.PersistentTasksCustomMetadata.lambda$static$1(PersistentTasksCustomMetadata.java:89) |  
  | at org.elasticsearch.xcontent.ObjectParser.lambda$declareField$10(ObjectParser.java:441) |  
  | at org.elasticsearch.xcontent.ObjectParser.parseValue(ObjectParser.java:619) |  
  | ... 44 more |  
```
</details>
x-pack/plugin/shutdown/src/internalClusterTest/java/org/elasticsearch/xpack/shutdown/NodeShutdownTasksIT.java
if (randomBoolean()) {
            shutdownNode = node1Id;
            candidateNode = node2Id;
        } else {
            shutdownNode = node2Id;
            candidateNode = node1Id;
        }
        logger.info("--> node {} will be shut down, {} will remain", shutdownNode, candidateNode);
        
        client().execute(
            PutShutdownNodeAction.INSTANCE,
            new PutShutdownNodeAction.Request(shutdownNode, SingleNodeShutdownMetadata.Type.REMOVE, "removal for testing", null, null)
        ).get();
        
        startTask.set(true);
        
        client().admin().cluster().prepareReroute().get();
        
        assertBusy(() -> assertNotNull("expected to have candidate nodes chosen for task", candidates.get()));
        
        assertThat(candidates.get().stream().map(DiscoveryNode::getId).collect(Collectors.toSet()), contains(candidateNode));
        assertThat(candidates.get().stream().map(DiscoveryNode::getId).collect(Collectors.toSet()), not(contains(shutdownNode)));
    }
    public static class TaskPlugin extends Plugin implements PersistentTaskPlugin {
        TaskExecutor taskExecutor;
        @Override
        public Collection<Object> createComponents(
            Client client,
            ClusterService clusterService,
            ThreadPool threadPool,