Repository navigation
Description
🐛 Describe the bug
After updating to Python 3.14 the function app was not able to start again (error message below).
Short error message:
cannot load the **** function: binding type "'client'" and dataType "durableClient" in the binding decorator do not match the corresponding function parameter's Python type annotation DurableOrchestrationClient .
azure-functions-durable version: 1.4.0 and 1.5.0
After some time debugging I was able to reveal the root cause. It is related to the Typehints.
# does not work
import azure.durable_functions as df
import azure.functions as func
@bp.event_grid_trigger(arg_name="azeventgrid")
@bp.durable_client_input(client_name="client")
async def my_function_name(
azeventgrid: func.EventGridEvent, client: df.DurableOrchestrationClient
) -> None:
# the typehint df.DurableOrchestrationClient is the root cause# does
import azure.durable_functions as df
import azure.functions as func
@bp.event_grid_trigger(arg_name="azeventgrid")
@bp.durable_client_input(client_name="client")
async def my_function_name(
azeventgrid: func.EventGridEvent, client
) -> None:
# removing the type hint is solving the issueBelow the full error message:
Microsoft.Azure.WebJobs.Script: Error building configuration in an external startup class. System.Private.CoreLib: One or more errors occurred. (Result: Failure Type: Exception: FunctionLoadError: cannot load the ****function: binding type "'client'" and dataType "durableClient" in the binding decorator do not match the corresponding function parameter's Python type annotation DurableOrchestrationClient Stack: Traceback (most recent call last): File "/azure-functions-host/workers/python/3.14/LINUX/X64/azure_functions_runtime/handle_event.py", line 99, in worker_init_request load_function_metadata( ~~~~~~~~~~~~~~~~~~~~~~^ init_request.function_app_directory, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ caller_info="worker_init_request") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/azure-functions-host/workers/python/3.14/LINUX/X64/azure_functions_runtime/handle_event.py", line 410, in load_function_metadata _metadata_result = (index_functions(function_path, function_app_directory)) \ ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/azure-functions-host/workers/python/3.14/LINUX/X64/azure_functions_runtime/handle_event.py", line 420, in index_functions process_indexed_function( ~~~~~~~~~~~~~~~~~~~~~~~~^ protos, ^^^^^^^ _functions, ^^^^^^^^^^^ indexed_functions, ^^^^^^^^^^^^^^^^^^ function_dir)) ^^^^^^^^^^^^^ File "/azure-functions-host/workers/python/3.14/LINUX/X64/azure_functions_runtime/loader.py", line 136, in process_indexed_function function_info = functions_registry.add_indexed_function( function=indexed_function, protos=protos) File "/azure-functions-host/workers/python/3.14/LINUX/X64/azure_functions_runtime/functions.py", line 429, in add_indexed_function settlement_client_arg) = self.validate_function_params( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ params, ^^^^^^^ ...<2 lines>... func_name, ^^^^^^^^^^ protos) ^^^^^^^ File "/azure-functions-host/workers/python/3.14/LINUX/X64/azure_functions_runtime/functions.py", line 270, in validate_function_params raise FunctionLoadError( ...<5 lines>... 'annotation ' + param_py_type.name) azure_functions_runtime.functions.FunctionLoadError: cannot load the **** function: binding type "'client'" and dataType "durableClient" in the binding decorator do not match the corresponding function parameter's Python type annotation DurableOrchestrationClient ). System.Private.CoreLib: Result: Failure Type: Exception: FunctionLoadError: cannot load the **** function: binding type "'client'" and dataType "durableClient" in the binding decorator do not match the corresponding function parameter's Python type annotation DurableOrchestrationClient Stack: Traceback (most recent call last): File "/azure-functions-host/workers/python/3.14/LINUX/X64/azure_functions_runtime/handle_event.py", line 99, in worker_init_request load_function_metadata( ~~~~~~~~~~~~~~~~~~~~~~^ init_request.function_app_directory, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ caller_info="worker_init_request") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/azure-functions-host/workers/python/3.14/LINUX/X64/azure_functions_runtime/handle_event.py", line 410, in load_function_metadata _metadata_result = (index_functions(function_path, function_app_directory)) \ ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/azure-functions-host/workers/python/3.14/LINUX/X64/azure_functions_runtime/handle_event.py", line 420, in index_functions process_indexed_function( ~~~~~~~~~~~~~~~~~~~~~~~~^ protos, ^^^^^^^ _functions, ^^^^^^^^^^^ indexed_functions, ^^^^^^^^^^^^^^^^^^ function_dir)) ^^^^^^^^^^^^^ File "/azure-functions-host/workers/python/3.14/LINUX/X64/azure_functions_runtime/loader.py", line 136, in process_indexed_function function_info = functions_registry.add_indexed_function( function=indexed_function, protos=protos) File "/azure-functions-host/workers/python/3.14/LINUX/X64/azure_functions_runtime/functions.py", line 429, in add_indexed_function settlement_client_arg) = self.validate_function_params( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ params, ^^^^^^^ ...<2 lines>... func_name, ^^^^^^^^^^ protos) ^^^^^^^ File "/azure-functions-host/workers/python/3.14/LINUX/X64/azure_functions_runtime/functions.py", line 270, in validate_function_params raise FunctionLoadError( ...<5 lines>... 'annotation ' + param_py_type.name) azure_functions_runtime.functions.FunctionLoadError: cannot load the **** function: binding type "'client'" and dataType "durableClient" in the binding decorator do not match the corresponding function parameter's Python type annotation DurableOrchestrationClient .
🤔 Expected behavior
What should have happened?
The function should be able to startup without issues when using the type hint.
☕ Steps to reproduce
What Durable Functions patterns are you using, if any?
Any minimal reproducer we can use?
See above
Are you running this locally or on Azure?
On Azure
⚡If deployed to Azure
We have access to a lot of telemetry that can help with investigations. Please provide as much of the following information as you can to help us investigate!
- Timeframe issue observed:
- Function App name:
- Function name(s):
- Azure region:
- Orchestration instance ID(s):
- Azure storage account name:
If you don't want to share your Function App or storage account name GitHub, please at least share the orchestration instance ID. Otherwise it's extremely difficult to look up information.
There is no instance ID because the function was not able to start up
Activity
ltwlf commentedon Mar 16, 2026
Same issue here. The
AgentFunctionAppfromagent-framework-azurefunctions(1.0.0b260311) also generates functions withdf.DurableOrchestrationClienttype annotations internally, making it impossible to use on Python 3.14. Workaround: pin to Python 3.13 (requires-python = '>=3.12,<3.14').nachogarcia commentedon Jul 12, 2026
Summary
On Python 3.14, every function decorated with
@app.durable_client_input(...)fails to index in the Azure Functions Python worker with:Because the client function fails to load, the host aborts startup (
Microsoft.Azure.WebJobs.Script.ExternalStartupException: "Error building configuration in an external startup class.") and the entire function app returns HTTP 503 on every request.The root cause is that
azure-functions-durable's rich-client binding relies on mutatingfunc.__annotations__and then re-wrapping the function withfunctools.wraps. On CPython 3.14functools.wrapspropagates__annotate__instead of__annotations__(deferred-annotation work, PEP 649 / PEP 749), so the annotation patch is silently reverted and the worker sees the realDurableOrchestrationClienttype again.This regressed in 1.6.0, which added the Python 3.14 support/classifier in #608. 1.6.0 is currently the only released version carrying the
Programming Language :: Python :: 3.14classifier, so there is no fixed version to upgrade to.Environment
azure-functions-durableazure-functionsazure-functions-durable==1.6.0on Python 3.13Symptom (production)
The app has HTTP-trigger functions that stack
@app.route(...)over@app.durable_client_input(client_name="client"):On the 3.14 worker these fail to index; the host then throws
ExternalStartupExceptionand returns 503 for all routes. The exact worker error (from Application InsightsAppExceptions.InnermostMessage):The same code deployed on Python 3.13 loads and runs correctly.
Root cause
DFApp._add_rich_client(inazure/durable_functions/decorators/durable_app.py) works around the worker's inability to type-check a rich client object by overwriting the parameter annotation tostr, then wrapping the user function:The function the worker ultimately indexes is
df_client_middleware(the@wraps-ed wrapper), and it is that wrapper's annotations the worker reads to validate thedurableClientbinding.The
functools.wrapsbehavior changed in CPython 3.14.functools.WRAPPER_ASSIGNMENTSnow copies__annotate__and no longer copies__annotations__:('__module__', '__name__', '__qualname__', '__annotations__', '__doc__')('__module__', '__name__', '__qualname__', '__doc__', '__annotate__', '__type_params__')Because the wrapper inherits the wrapped function's
__annotate__(which lazily recomputes the original source annotation), the earlieruser_code.__annotations__[parameter_name] = strmutation is overridden. The wrapper's annotations resolve back toDurableOrchestrationClient, and the worker's binding/annotation check fails.Minimal, self-contained reproduction (no Azure host needed)
On Python 3.13
wrapper.__annotations__is{'client': str}(the patch survives, becausewrapscopied__annotations__), which is why the same code loads there.Why #608's 3.14 validation didn't catch it
#608 ("Patch dependency CVEs, drop Python 3.9, add Python 3.10–3.14 support") added the 3.14 classifier and a 3.14 CI leg, validated as "Test suite passes on 3.13 and 3.14: 309 passed." Those are the library's own unit tests; they don't run the function through the Azure Functions Python worker's indexing/binding-validation path, which is the only place the wrapper's annotations are read back to validate the
durableClientbinding. So the_add_rich_client+functools.wrapsinteraction on 3.14 was never exercised, and the 3.14 leg stayed green while real function apps fail to start.Impact
durable_client_input(i.e. essentially every Durable Functions client) fails to start on Python 3.14 and returns 503 for all routes.Suggested fix
Apply the annotation override to the wrapper (after
@wraps), and make it survive PEP 649 deferred annotations — e.g. set the wrapper's__annotations__explicitly and clear its__annotate__so both the dict-based and__annotate__-based readers agree:(Verified on 3.14: with
__annotate__set toNoneand__annotations__explicitly holding{parameter_name: str},annotationlib.get_annotations(..., format=VALUE|FORWARDREF)both returnstr.) Alternatively, exclude__annotate__/__annotations__from thewrapscopy for this wrapper, or migrate off the annotation-mutation workaround entirely now that the worker supports SDK/deferred-binding types.Adding a CI leg that indexes a
durable_client_inputfunction through the actual Python worker on 3.14 would prevent regressions of this class.References
_add_rich_clientinazure/durable_functions/decorators/durable_app.py(v1.6.0)functools.wraps/WRAPPER_ASSIGNMENTSupdate)