### Apache Airflow version

2.7.2

### What happened

Sent request without dry_run parameter to dags/{dag_id}/updateTaskInstancesState and got a 500 error.

### What you think should happen instead

I should be able to send a request to update task instances state and get a valid response.

### How to reproduce

You can see this by commenting out line 215 in tests/api_connexion/schemas/test_task_instance_schema.py and running tests. This is a similar error to #34563.

### Operating System

Ubuntu 20.04

### Versions of Apache Airflow Providers

_No response_

### Deployment

Docker-Compose

### Deployment details

_No response_

### Anything else

_No response_

### Are you willing to submit PR?

- [X] Yes I am willing to submit a PR!

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)

@pytest.fixture(autouse=True)
    def set_attrs(self, session, dag_maker):
        self.default_time = datetime(2020, 1, 1)
        with dag_maker(dag_id="TEST_DAG_ID", session=session):
            self.task = EmptyOperator(task_id="TEST_TASK_ID", start_date=self.default_time)
        self.dr = dag_maker.create_dagrun(execution_date=self.default_time)
        session.flush()
        self.default_ti_init = {
            "run_id": None,
            "state": State.RUNNING,
        }
        self.default_ti_extras = {
            "dag_run": self.dr,
            "start_date": self.default_time + dt.timedelta(days=1),
            "end_date": self.default_time + dt.timedelta(days=2),
            "pid": 100,
            "duration": 10000,
            "pool": "default_pool",
            "queue": "default_queue",
            "note": "added some notes",
        }
        yield
        session.rollback()
    def test_task_instance_schema_without_sla_and_rendered(self, session):