---
type: email
from: MUHAMMAD SALMAN HUSSAIN <notifications@github.com>
subject: [openai/openai-agents-python] fix(strict_schema): correct error

 message and replace runtime assert (PR #1920)
received: 2026-03-06 08:07:03
date_header: Fri, 17 Oct 2025 06:19:49 -0700
priority: normal
status: awaiting_approval
uid: 32831
---

## Email Content

**From:** MUHAMMAD SALMAN HUSSAIN <notifications@github.com>
**Subject:** [openai/openai-agents-python] fix(strict_schema): correct error

 message and replace runtime assert (PR #1920)
**Date:** Fri, 17 Oct 2025 06:19:49 -0700

### Body (preview)

This commit addresses two critical issues in the strict schema validation:



1. **Corrected error message for additionalProperties**:

   - Changed the misleading error message from &quot;additionalProperties should not be set&quot; to &quot;additionalProperties should be set to False&quot;

   - This accurately reflects the requirement that object types must explicitly set `additionalProperties: false` rather than implying it shouldn&#39;t be set at all

   - Prevents confusion for users encountering this validation error



2. **Replaced dangerous assert with proper exception handling**:

   - Replaced the `assert is_dict(value)` statement with proper runtime validation

   - Now raises a `ValueError` with clear message instead of relying on `assert`

   - Ensures validation works properly in optimized Python environments (when run with `-O` flag)

   - Maintains the same error semantics while making the code production-safe



Both fixes maintain backward compatibility while improving error clarity and runtime safety.

You can view, comment on, or merge this pull request online at:



  https://github.com/openai/openai-agents-python/pull/1920



-- Commit Summary --



  * fix(strict_schema): correct error message and replace runtime assert



-- File Changes --



    M src/agents/strict_schema.py (7)



-- Patch Links --



https://github.com/openai/openai-agents-python/pull/1920.patch

https://github.com/openai/openai-agents-python/pull/1920.diff



-- 

Reply to this email directly or view it on GitHub:

https://github.com/openai/openai-agents-python/pull/1920

You are receiving this because you are subscribed to this thread.



Message ID: &lt;openai/openai-agents-python/pull/1920@github.com&gt;

---

## Suggested Actions
- [ ] Reply
- [ ] Archive
- [ ] Escalate
