[GH-ISSUE #976] serve: structured-output failure path returns error: null instead of 502 structured_output_failed (test_responses) #429

Closed
opened 2026-11-04 01:42:58 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @AmjedMVP on GitHub (Oct 5, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/976

Summary

serve/test_responses.py::test_json_schema_text_format errors on main (6f32ec0): the HTTP response's error field is None where the test expects an error object (502 / structured_output_failed), and the test then does r["error"]["..."] → TypeError: 'NoneType' object is not subscriptable.

Environment

  • Ubuntu 26.04 LTS (WSL2), x86_64, Python 3.14.4, fresh clone @ 6f32ec0, .venv + requirements installed
  • No GPU involved — MockEngine-based

Reproduce

python3 -m unittest serve/test_responses.py -v
ERROR: test_json_schema_text_format (__main__.OverHttp.test_json_schema_text_format)
TypeError: 'NoneType' object is not subscriptable

Ran 19 tests ... FAILED (errors=1); the other 18 pass.

Interpretation

On the structured-output-failure path the server appears to return a 200-shaped body with "error": null instead of the expected 502 structured_output_failed error object. So beyond the test error itself, there is likely a real API-contract issue: clients checking resp["error"] can't detect a failed JSON-schema generation. The other test_responses cases pass, so this is specific to the json-schema text-format path.

Originally created by @AmjedMVP on GitHub (Oct 5, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/976 ## Summary `serve/test_responses.py::test_json_schema_text_format` errors on `main` (6f32ec0): the HTTP response's `error` field is `None` where the test expects an error object (502 / `structured_output_failed`), and the test then does `r["error"]["..."]` → `TypeError: 'NoneType' object is not subscriptable`. ## Environment - Ubuntu 26.04 LTS (WSL2), x86_64, Python 3.14.4, fresh clone @ `6f32ec0`, `.venv` + requirements installed - No GPU involved — MockEngine-based ## Reproduce ```sh python3 -m unittest serve/test_responses.py -v ``` ``` ERROR: test_json_schema_text_format (__main__.OverHttp.test_json_schema_text_format) TypeError: 'NoneType' object is not subscriptable ``` `Ran 19 tests ... FAILED (errors=1)`; the other 18 pass. ## Interpretation On the structured-output-failure path the server appears to return a 200-shaped body with `"error": null` instead of the expected 502 `structured_output_failed` error object. So beyond the test error itself, there is likely a real API-contract issue: clients checking `resp["error"]` can't detect a failed JSON-schema generation. The other `test_responses` cases pass, so this is specific to the json-schema text-format path.
Author
Owner

@talisp commented on GitHub (Oct 5, 2026):

Same here on 6f32ec0 (Ubuntu 22.04, Python 3.10 venv). The cause is that jsonschema is not installed: the server then cannot validate the output, so the 502 structured_output_failed path never runs, and the response has error: null. The other jsonschema tests in the suite are skipped in that case; this one has no skip guard.

#785 ("test_json_schema_text_format's schema failure only where jsonschema is installed") addressed exactly this, but it was closed without being merged.

<!-- gh-comment-id:6001503225 --> @talisp commented on GitHub (Oct 5, 2026): Same here on 6f32ec0 (Ubuntu 22.04, Python 3.10 venv). The cause is that `jsonschema` is not installed: the server then cannot validate the output, so the 502 `structured_output_failed` path never runs, and the response has `error: null`. The other jsonschema tests in the suite are skipped in that case; this one has no skip guard. #785 ("test_json_schema_text_format's schema failure only where jsonschema is installed") addressed exactly this, but it was closed without being merged.
Author
Owner

@Niko1221 commented on GitHub (Oct 6, 2026):

Already fixed on main after 0.1.39 (#785): the test checks the schema failure only where jsonschema is installed. Without it the server cannot validate the output, so the 502 path does not run, as you found. pip install jsonschema runs the full test.

<!-- gh-comment-id:6010943506 --> @Niko1221 commented on GitHub (Oct 6, 2026): Already fixed on main after 0.1.39 (#785): the test checks the schema failure only where `jsonschema` is installed. Without it the server cannot validate the output, so the 502 path does not run, as you found. `pip install jsonschema` runs the full test.
Author
Owner

@AmjedMVP commented on GitHub (Oct 6, 2026):

Confirmed fixed — reran serve/test_responses.py on 82f46a8 (WSL2 Ubuntu 26.04, Python 3.14.4, no jsonschema in the venv): all 19 tests OK, the unguarded case now skips like its siblings. Thanks. (We didn't re-verify the with-jsonschema 502 path itself — that runs only with pip install jsonschema.)

<!-- gh-comment-id:6014889573 --> @AmjedMVP commented on GitHub (Oct 6, 2026): Confirmed fixed — reran `serve/test_responses.py` on `82f46a8` (WSL2 Ubuntu 26.04, Python 3.14.4, no jsonschema in the venv): all 19 tests OK, the unguarded case now skips like its siblings. Thanks. (We didn't re-verify the with-jsonschema 502 path itself — that runs only with `pip install jsonschema`.)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#429
No description provided.