RestApiTool crashes on a request body media type that has no schema
維護者通常 4 天內回覆
@llalitkumarrr 已經在處理了。
開始於 2026年10月30日。
評估
研究方向
找出 RestApiTool._prepare_request_params,並將其對原始請求本文 schema 的存取方式與 OperationParser 的 _schema_from_openapi 正規化進行比較。使用提供的 Operation、MediaType() 和位元組型別的本文值重現問題。完成條件是呼叫不再引發例外,並以 Content-Type: application/octet-stream 傳送位元組;issue 未指定測試檔案。
由索引模型根據 Issue 內容生成。
描述
🔴 Required Information
Describe the Bug:
A RestApiTool whose request body declares a media type without a schema (OpenAPI allows content: {application/octet-stream: {}}) crashes when called:
AttributeError: 'NoneType' object has no attribute 'type'
OperationParser handles this case: it normalizes the schema with _schema_from_openapi, where None becomes Schema(), and exposes a single body parameter. RestApiTool._prepare_request_params then reads media_type_object.schema_ raw and calls .type on None. So the tool is generated and offered to the model, but every call fails. mypy already reports these lines (Item "None" of "Schema | Reference | Any | None" has no attribute "type").
Steps to Reproduce:
op = Operation(
operationId="upload_contract",
requestBody=RequestBody(content={"application/octet-stream": MediaType()}),
)
params = OperationParser(op).get_parameters() # [body]
tool = RestApiTool(name="upload_contract", description="...", endpoint=..., operation=op)
tool._prepare_request_params(params, {"body": b"%PDF-1.7"})
Expected Behavior:
The bytes are sent as the request body with Content-Type: application/octet-stream.
Observed Behavior:
AttributeError: 'NoneType' object has no attribute 'type'
Environment Details:
- ADK Library Version (pip show google-adk): 2.13.0 (also on
mainat 75fb788) - Desktop OS: macOS
- Python Version (python -V): 3.11.16
Model Information:
- Are you using LiteLLM: No
- Which model is being used: N/A (tool request building)
🟡 Optional Information
How often has this issue occurred?:
- Always (100%), for request bodies whose media type has no schema
- 主要語言
- Python
- 星號
- 22.1k
- 分支
- 4.3k
- 平均合併
- 1 天 10 小時
- 30 天內合併 PR
- 5
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
google/adk-python 的其他 Issue
-
Regression of #3977 / #4054: `adk create` accepts hyphens in agent names, agent then fails to load可能已有人在做 @surajksharma07 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 83/100
google/adk-python#8002 · 2 則留言 · 已指派 1 人 ·
維護者通常 4 天內回覆
-
ContainerCodeExecutor drops output files that are hard links可能已有人在做 @llalitkumarrr 於 4 天前認領。 未關閉core
難度 2/5 1-3 小時 新手友好度 76/100
google/adk-python#7906 · 3 則留言 · 已指派 1 人 ·
維護者通常 4 天內回覆
-
GCS skill loaders ignore a skill.md manifest that the local and zip loaders accept可能已有人在做 @surajksharma07 於 7 天前認領。 未關閉tools
難度 2/5 1-3 小時 新手友好度 84/100
google/adk-python#7842 · 3 則留言 · 已指派 1 人 ·
維護者通常 4 天內回覆
-
LiteLlm with SSE streaming records the answer twice in gen_ai.output.messages可能已有人在做 @surajksharma07 於 15 天前認領。 未關閉models
難度 2/5 1-3 小時 新手友好度 78/100
google/adk-python#7630 · 11 則留言 · 已指派 1 人 ·
維護者通常 4 天內回覆
-
CI Mypy Check flags an existing streaming_utils.py error as new because the PR run reuses the baseline's mypy cache可能已有人在做 @DeanChensj 於 31 天前認領。 未關閉needs review
難度 2/5 1-3 小時 新手友好度 72/100
google/adk-python#7409 · 1 則留言 · 已指派 2 人 ·
維護者通常 4 天內回覆
查看 google/adk-python 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 74/100
strawberry-graphql/strawberry#4794 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
dataforgoodfr/cetolog#21 ·
-
難度 2/5 1-3 小時 新手友好度 76/100
btclib-org/btclib#2932 ·
維護者通常 1 天內回覆
-
metrics priority: medium
難度 1/5 1-3 小時 新手友好度 86/100
LearningCircuit/local-deep-research#8336 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 80/100