You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
RestApiTool raises uncaught KeyError when a required path param is omitted #7282
FunctionTool returns {"error": ...} when mandatory args are missing so the model can retry.
RestApiTool maps filled args into path_params, then does self.endpoint.path.format(**path_params) in _prepare_request_params. An omitted required path parameter leaves a template key unset → KeyError (original OpenAPI name, e.g. 'userId').
RestApiTool.call only catches TimeoutException / HTTPStatusError, so the agent invocation aborts instead of returning a retryable tool error.
py_names for the param include user_id (declaration expects snake_case), but missing value still crashes via format
Expected
Missing required path params should return a structured tool error (mirror FunctionTool._get_mandatory_args) so the model can retry, not abort the agent run.
Suggested fix
Before format, verify every {placeholder} in the path is present; on miss return {"error": "missing path parameter …"}. Optionally catch KeyError/ValueError from _prepare_request_params in call.
Notes
Nearby RestApiTool crashes #7164 (header type) and #7206 (non-UTF-8 body) are different sites. Happy to open a PR.
Picking this one up now — opening a PR shortly. Flagging it here so nobody duplicates the work; if someone is already on it, say so and I will drop mine.
Thanks for picking this up so quickly — and for the PRs (#7285 / #7284 / #7283). Happy to review or clarify anything from the original repros if useful.
We reproduced this issue in version 2.10.0, and it remains reproducible with this version as well. Furthermore we tested #7283 as well and it should resolve this issue. Could you please test it and provide your feedback?
Looked at #7283. Catching the KeyError from _prepare_request_params and returning a structured error matches the report, and the new test checks that the request is not sent and that userId appears in the error.
One caveat: any KeyError inside _prepare_request_params is reported as a missing path parameter, even if the missing key is something else. Narrowing that to actual path params would be safer. I reviewed the diff only and have not run the suite.
Follow-up after running the tests. On #7283 (74dda20), test_rest_api_tool.py passed 100 tests, including the new missing-path-param case.
The caveat is real. A required query param named query on /search?q={query}, supplied as query=hello, returns Missing required path parameter 'query' and never makes the HTTP call. A KeyError raised from _default_headers is reported the same way.
Activity
chelsealong commentedon Sep 25, 2026
Picking this one up now — opening a PR shortly. Flagging it here so nobody duplicates the work; if someone is already on it, say so and I will drop mine.
michaelkillgta commentedon Sep 25, 2026
Thanks for picking this up so quickly — and for the PRs (#7285 / #7284 / #7283). Happy to review or clarify anything from the original repros if useful.
llalitkumarrr commentedon Sep 29, 2026
Hello @michaelkillgta,
We reproduced this issue in version 2.10.0, and it remains reproducible with this version as well. Furthermore we tested #7283 as well and it should resolve this issue. Could you please test it and provide your feedback?
michaelkillgta commentedon Sep 30, 2026
Looked at #7283. Catching the KeyError from
_prepare_request_paramsand returning a structured error matches the report, and the new test checks that the request is not sent and thatuserIdappears in the error.One caveat: any KeyError inside
_prepare_request_paramsis reported as a missing path parameter, even if the missing key is something else. Narrowing that to actual path params would be safer. I reviewed the diff only and have not run the suite.michaelkillgta commentedon Sep 30, 2026
Follow-up after running the tests. On #7283 (
74dda20),test_rest_api_tool.pypassed 100 tests, including the new missing-path-param case.The caveat is real. A required query param named
queryon/search?q={query}, supplied asquery=hello, returnsMissing required path parameter 'query'and never makes the HTTP call. AKeyErrorraised from_default_headersis reported the same way.fix: return structured error when RestApiTool is missing required pat…