Repository navigation
Open
Labels
BatchService AttentionWorkflow: This issue is responsible by Azure service team.Workflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Description
- Package Name: azure-batch
- Package Version: 15.1.0
- Operating System: Ubuntu 24.04
- Python Version: 3.13.13
Describe the bug
BatchClient.begin_terminate_job() doesn't correctly handle the case where you call it with the default value for the options parameter. It also fails identically with a default-constructed BatchJobTerminateOptions passed to it. The stack trace is:
File "/opt/hostedtoolcache/Python/3.13.13/x64/lib/python3.13/site-packages/azure/batch/_operations/_patch.py", line 1008, in begin_terminate_job
self._terminate_job_internal(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
job_id,
^^^^^^^
...<9 lines>...
**kwargs,
^^^^^^^^^
),
^
File "/opt/hostedtoolcache/Python/3.13.13/x64/lib/python3.13/site-packages/azure/core/tracing/decorator.py", line 119, in wrapper_use_tracer
return func(*args, **kwargs)
File "/opt/hostedtoolcache/Python/3.13.13/x64/lib/python3.13/site-packages/azure/batch/_operations/_operations.py", line 5806, in _terminate_job_internal
_request = build_batch_terminate_job_internal_request(
job_id=job_id,
...<11 lines>...
params=_params,
)
File "/opt/hostedtoolcache/Python/3.13.13/x64/lib/python3.13/site-packages/azure/batch/_operations/_operations.py", line 1071, in build_batch_terminate_job_internal_request
_headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str")
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.13.13/x64/lib/python3.13/site-packages/azure/batch/_utils/serialization.py", line 758, in header
output = self.serialize_data(data, data_type, **kwargs)
File "/opt/hostedtoolcache/Python/3.13.13/x64/lib/python3.13/site-packages/azure/batch/_utils/serialization.py", line 777, in serialize_data
raise ValueError("No value for given attribute")
ValueError: No value for given attribute
From this we can determine what the happens to cause this bug:
_terminate_job_internalonly setscontent_typeifoptionsis true (in the bool sense). Neither the default value (None) nor the default-constructedBatchJobTerminateOptionsevaluate to true. Socontent_typeends up equal toNone.build_batch_terminate_job_internal_requestwill always set the content-type header, regardless of if content-type was actually provided (_headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str")). This should be guarded by anifstatement like all of the other headers are.
To Reproduce
Steps to reproduce the behavior:
- Call
BatchClient.begin_terminate_jobwith the default value foroptions(or with a default constructedBatchJobTerminateOptions). - Observe the crash above.
Expected behavior
The default value should work.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
BatchService AttentionWorkflow: This issue is responsible by Azure service team.Workflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Activity
kashifkhan commentedon Jun 10, 2026
Thank you the feedback wiboris . Ive routed this to the team that can help you further
github-actions commentedon Jun 10, 2026
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc Rena (@cRui861) David Watrous (@dpwatrous) Jingjing Li (@jingjlii) JJJessieWang Haopeng Wang (@wanghoppe) wiboris.
msyyc commentedon Sep 18, 2026
emitter issue is fixed in microsoft/typespec#11272 then related owner could release a new SDK versoin with latest emitter codegen.