diff --git a/core/modules/workflows/src/Plugin/WorkflowTypeBase.php b/core/modules/workflows/src/Plugin/WorkflowTypeBase.php
index 32ade73..6045484 100644
--- a/core/modules/workflows/src/Plugin/WorkflowTypeBase.php
+++ b/core/modules/workflows/src/Plugin/WorkflowTypeBase.php
@@ -178,7 +178,11 @@ public function setStateLabel($state_id, $label) {
    */
   public function setStateWeight($state_id, $weight) {
     if (!$this->hasState($state_id)) {
-      throw new \InvalidArgumentException("The state '$state_id' does not exist in workflow.'");
+      throw new \InvalidArgumentException("The state '$state_id' does not exist in workflow.");
+    }
+    if (!is_numeric($weight)) {
+      $label = $this->getState($state_id)->label();
+      throw new \InvalidArgumentException("The weight '$weight' must be numeric for state '$label'.");
     }
     $this->configuration['states'][$state_id]['weight'] = $weight;
     return $this;
@@ -390,7 +394,11 @@ public function setTransitionLabel($transition_id, $label) {
    */
   public function setTransitionWeight($transition_id, $weight) {
     if (!$this->hasTransition($transition_id)) {
-      throw new \InvalidArgumentException("The transition '$transition_id' does not exist in workflow.'");
+      throw new \InvalidArgumentException("The transition '$transition_id' does not exist in workflow.");
+    }
+    if (!is_numeric($weight)) {
+      $label = $this->getTransition($transition_id)->label();
+      throw new \InvalidArgumentException("The weight '$weight' must be numeric for transition '$label'.");
     }
     $this->configuration['transitions'][$transition_id]['weight'] = $weight;
     return $this;
diff --git a/core/modules/workflows/tests/src/Unit/WorkflowTest.php b/core/modules/workflows/tests/src/Unit/WorkflowTest.php
index 8cf4493..dc77a3d 100644
--- a/core/modules/workflows/tests/src/Unit/WorkflowTest.php
+++ b/core/modules/workflows/tests/src/Unit/WorkflowTest.php
@@ -226,6 +226,16 @@ public function testSetStateWeightException() {
   }
 
   /**
+   * @covers ::setStateWeight
+   */
+  public function testSetStateWeightNonNumericException() {
+    $this->setExpectedException(\InvalidArgumentException::class, "The weight 'foo' must be numeric for state 'Published'.");
+    $workflow = new Workflow(['id' => 'test', 'type' => 'test_type'], 'workflow');
+    $workflow->getTypePlugin()->addState('published', 'Published');
+    $workflow->getTypePlugin()->setStateWeight('published', 'foo');
+  }
+
+  /**
    * @covers ::deleteState
    */
   public function testDeleteState() {
@@ -557,6 +567,17 @@ public function testSetTransitionWeightException() {
   }
 
   /**
+   * @covers ::setTransitionWeight
+   */
+  public function testSetTransitionWeightNonNumericException() {
+    $this->setExpectedException(\InvalidArgumentException::class, "The weight 'foo' must be numeric for transition 'Publish'.");
+    $workflow = new Workflow(['id' => 'test', 'type' => 'test_type'], 'workflow');
+    $workflow->getTypePlugin()->addState('published', 'Published');
+    $workflow->getTypePlugin()->addTransition('publish', 'Publish', [], 'published');
+    $workflow->getTypePlugin()->setTransitionWeight('publish', 'foo');
+  }
+
+  /**
    * @covers ::setTransitionFromStates
    */
   public function testSetTransitionFromStates() {
