GitHub user chandakanant created a discussion: 
airflow.sdk.api.client.ServerResponseError

**Airflow Version - 3.0.2**

Airflow Helm Chart Version - 1.18.0

I am using `KubernetesExecutor`. 
Task logs -
```
 {"timestamp":"2026-09-16T05:08:32.501964Z","level":"info","event":"Executing 
workload","workload":"ExecuteTask(token='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 
ti=TaskInstance(id=UUID('01a0a88a-5cb9-772e-9621-45ed1459872e'), 
task_id='margin_calculation_reports_group.report_store_ids', 
dag_id='margin_calculation_reports_parallel', 
run_id='manual__2026-09-16T04:44:37.000031+00:00', try_number=2, map_index=87, 
pool_slots=1, queue='default', priority_weight=2, executor_config=None, 
parent_context_carrier={}, context_carrier={}, 
queued_dttm=datetime.datetime(2026, 9, 16, 5, 4, 23, 983346, 
tzinfo=TzInfo(UTC))), 
dag_rel_path=PurePosixPath('reports/margin_calculation_reports.py'), 
bundle_info=BundleInfo(name='dags-folder', version=None), 
log_path='dag_id=gross_margin_calculation_reports_parallel_us_prod/run_id= 
manual__2026-09-16T04:44:37.000031+00:00/task_id=margin_calculation_reports_parallel.report_store_ids/map_index=87/attempt=2.log',
 type='ExecuteTask')","logger" :"__main__"}                  
                                                                                
                                                                                
 {"timestamp":"2026-09-16T05:08:32.968329Z","level":"info","event":"Connecting 
to 
server:","server":"http://airflow-api-server:8080/execution/","logger":"__main__"}
 {"timestamp":"2026-09-16T05:08:33.058352Z","level":"info","event":"Secrets 
backends loaded for 
worker","count":1,"backend_classes":["EnvironmentVariablesBackend"],"logger":"supervisor"}
 {"timestamp":"2026-09-16T05:08:33.093042Z","level":"warning","event":"Server 
error","detail":{"detail":{"reason":"invalid_state","message":"TI was not in a 
state where it could be marked as 
running","previous_state":"running"}},"logger":"airflow.sdk.api.client"}

Traceback (most recent call last):
   File "<frozen runpy>", line 198, in _run_module_as_main                      
                                                                                
                              
   File "<frozen runpy>", line 88, in _run_code                                 
                                                                                
                              
   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/execution_time/execute_workload.py",
 line 125, in <module>                                                          
  
 {"timestamp":"2026-09-16T05:08:33.101041Z","level":"info","event":"Process 
exited","pid":14,"exit_code":-9,"signal_sent":"SIGKILL","logger":"supervisor"}  
                                  
     main()                                                                     
                                                                                
                              
   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/execution_time/execute_workload.py",
 line 121, in main                                                              
   
     execute_workload(workload)                                                 
                                                                                
                              
   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/execution_time/execute_workload.py",
 line 66, in execute_workload                                                   
   
     supervise(                                                                 
                                                                                
                              
   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/execution_time/supervisor.py",
 line 1540, in supervise                                                        
         
     process = ActivitySubprocess.start(                                        
                                                                                
                              
               ^^^^^^^^^^^^^^^^^^^^^^^^^                                        
                                                                                
                              
   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/execution_time/supervisor.py",
 line 800, in start                                                             
         
     proc._on_child_started(ti=what, dag_rel_path=dag_rel_path, 
bundle_info=bundle_info)                                                        
                                              
   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/execution_time/supervisor.py",
 line 811, in _on_child_started                                                 
         
     ti_context = self.client.task_instances.start(ti.id, self.pid, start_date) 
                                                                                
                              
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
                                                                                
                              
   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/api/client.py", 
line 149, in start                                                              
                       
     resp = self.client.patch(f"task-instances/{id}/run", 
content=body.model_dump_json())                                                 
                                                    
            
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^   
                                                                                
                  
   File "/home/airflow/.local/lib/python3.12/site-packages/httpx/_client.py", 
line 1219, in patch                                                             
                                
     return self.request(                                                       
                                                                                
                              
            ^^^^^^^^^^^^^                                                       
                                                                                
                              
   File 
"/home/airflow/.local/lib/python3.12/site-packages/tenacity/__init__.py", line 
338, in wrapped_f                                                               
                       
     return copy(f, *args, **kw)                                                
                                                                                
                              
            ^^^^^^^^^^^^^^^^^^^^
  File 
"/home/airflow/.local/lib/python3.12/site-packages/tenacity/__init__.py", line 
477, in __call__                                                                
                       
     do = self.iter(retry_state=retry_state)                                    
                                                                                
                              
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                    
                                                                                
                              
   File 
"/home/airflow/.local/lib/python3.12/site-packages/tenacity/__init__.py", line 
378, in iter                                                                    
                       
     result = action(retry_state)                                               
                                                                                
                              
              ^^^^^^^^^^^^^^^^^^^                                               
                                                                                
                              
   File 
"/home/airflow/.local/lib/python3.12/site-packages/tenacity/__init__.py", line 
400, in <lambda>                                                                
                       
     self._add_action_func(lambda rs: rs.outcome.result())                      
                                                                                
                              
                                      ^^^^^^^^^^^^^^^^^^^                       
                                                                                
                              
   File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 449, in 
result                                                                          
                                
     return self.__get_result()                                                 
                                                                                
                              
            ^^^^^^^^^^^^^^^^^^^                                                 
                                                                                
                              
   File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in 
__get_result                                                                    
                                
     raise self._exception                                                      
                                                                                
                              
   File 
"/home/airflow/.local/lib/python3.12/site-packages/tenacity/__init__.py", line 
480, in __call__                                                                
                       
     result = fn(*args, **kwargs)                                               
                                                                                
                              
              ^^^^^^^^^^^^^^^^^^^                                               
                                                                                
                              
   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/api/client.py", 
line 707, in request                                                            
                       
     return super().request(*args, **kwargs)                                    
                                                                                
                              
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                    
                                                                                
                              
   File "/home/airflow/.local/lib/python3.12/site-packages/httpx/_client.py", 
line 827, in request                                                            
                                
     return self.send(request, auth=auth, follow_redirects=follow_redirects)    
                                                                                
                              
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^    
                                                                                
                              
   File "/home/airflow/.local/lib/python3.12/site-packages/httpx/_client.py", 
line 914, in send                                                               
                                
     response = self._send_handling_auth(                                       
                                                                                
                              
                ^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/home/airflow/.local/lib/python3.12/site-packages/httpx/_client.py", 
line 942, in _send_handling_auth                                                
                                
     response = self._send_handling_redirects(                                  
                                                                                
                              
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                  
                                                                                
                              
   File "/home/airflow/.local/lib/python3.12/site-packages/httpx/_client.py", 
line 999, in _send_handling_redirects                                           
                                
     raise exc                                                                  
                                                                                
                              
   File "/home/airflow/.local/lib/python3.12/site-packages/httpx/_client.py", 
line 982, in _send_handling_redirects                                           
                                
     hook(response)                                                             
                                                                                
                              
   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/api/client.py", 
line 120, in raise_on_4xx_5xx_with_note                                         
                       
     return get_json_error(response) or response.raise_for_status()             
                                                                                
                              
            ^^^^^^^^^^^^^^^^^^^^^^^^                                            
                                                                                
                              
   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/api/client.py", 
line 110, in get_json_error                                                     
                       
     raise err                                                                  
                                                                                
                              
 airflow.sdk.api.client.ServerResponseError: Server returned error              
                                                                                
                              
 Correlation-id=01a0a89d-dcac-70f7-ad43-cb175020ceff
```

Airflow Config that I am using -

```
config:
  api: 
    base_url: "${var.environment == "production" ? 
"https://airflow.${var.region}a.com"; : 
"https://airflow.${var.region}a.${var.environment}.com"}";
    worker_timeout: 600
  api_auth:
    jwt_secret: "airflow-jwt-secret"
  webserver:
    page_size: 25
    base_url: "${var.environment == "production" ? 
"https://airflow.${var.region}a.com"; : 
"https://airflow.${var.region}a.${var.environment}.com"}";
  core:
    dags_folder: /opt/airflow/dags/repo/dags_us
    max_active_tasks_per_dag: 50
    max_active_runs_per_dag: 16
    dagbag_import_timeout: 600
    non_pooled_task_slot_count: 1000
    dag_concurrency: 10000
    parallelism: 500
    default_pool_task_slot_count: 1000
    default_timezone: "utc"
  dag_processor:
    min_file_process_interval: 120
  logging:
    fab_logging_level: "ERROR"
    logging_level: "INFO"
  database:
    sql_alchemy_max_overflow: 50
    sql_alchemy_pool_enabled: true
    sql_alchemy_pool_pre_ping: true
    sql_alchemy_pool_recycle: 600
    sql_alchemy_pool_size: 300
  scheduler:
    dag_file_processor_timeout : 1000
    enable_health_check: true
    job_heartbeat_sec: 300
    max_dagruns_per_loop_to_schedule: 175
    max_dagruns_to_create_per_loop: 175
    max_tis_per_query: 300
    scheduler_health_check_threshold: 120
    scheduler_zombie_task_threshold: 300
  kubernetes_executor: 
    worker_pods_creation_batch_size : 1000
    delete_worker_pods: true
    delete_worker_pods_on_failure: false
```

Any help will be highly appreciated. Thank you

GitHub link: https://github.com/apache/airflow/discussions/73230

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to