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
[BUG] AI Assistant fails with "Invalid schema for response_format": Missing 'configFiles' in required array #4267
Fill in your needs in Step 1 and proceed to Step 2
The error appears immediately at Step 2 "Choose a Variant"
Error message:
Invalid schema for response_format 'response': In context=('properties', 'suggestions', 'items'), 'required' is required to be supplied and to be an array including every key in properties. Missing 'configFiles'.
Dokploy version: v0.29.1
Current vs. Expected behavior
Current behavior: The AI Assistant fails at Step 2 "Choose a Variant" with a schema validation error. The configFiles field is defined in the suggestions.items.properties of the JSON Schema sent to the OpenAI API as response_format, but it is NOT listed in the required array. Modern OpenAI models (e.g. gpt-4o) enforce strict mode and require ALL properties to be listed in required.
Root cause: In packages/server/src/services/ai.ts, the Zod schema marks configFiles as .optional(), but when converted to JSON Schema for response_format, OpenAI strict mode requires every key in properties to be present in required (with optional fields using anyOf: [{...}, {type: 'null'}] instead).
Expected behavior: The AI Assistant should generate variant suggestions without error.
Provide environment information
Operating System:
OS: Ubuntu 22.04
Arch: x64
Dokploy version: v0.29.1
VPS Provider: Hostinger
AI Provider: OpenAI (gpt-4o)
What applications/services are you trying to deploy?
Any service via AI Assistant template generator
Which area(s) are affected? (Select all that apply)
Application
Are you deploying the applications where Dokploy is installed or on a remote server?
Same server where Dokploy is installed
Additional context
The fix should be in packages/server/src/services/ai.ts. The configFiles field in the fullSchema Zod object is marked as .optional(), but OpenAI strict mode requires all properties to be in required. The fix is to either:
Add configFiles to required and use z.nullable() or anyOf with null type
Or disable strict mode for this specific response_format call
Hi @qveys! I'm Dosu and I’m helping the dokploy team.
You've correctly identified the root cause. The configFiles field is marked as .optional() in the Zod schema [1], and when the AI SDK converts this to a JSON Schema for OpenAI's response_format, the field gets excluded from the required array — which OpenAI's strict structured output mode rejects.
The fix would be to change configFiles from .optional() to .nullable() with a .default(null) or simply make it a required field defaulting to an empty array. For example:
// Option 1: nullable (generates anyOf with null type, satisfying strict mode)configFiles: z.array(z.object({content: z.string(),filePath: z.string(),}),).nullable(),// Option 2: required with empty array as the expected defaultconfigFiles: z.array(z.object({content: z.string(),filePath: z.string(),}),),
Option 2 is simpler and would also require no changes downstream since configFiles is already handled with optional chaining in the UI components (from PR #2653). You'd just get an empty array instead of undefined.
This was introduced during the migration from generateObject to generateText with Output.object() in PR #3718, which may have changed how the schema gets serialized to OpenAI's format.
Activity
dosubot commentedon Apr 21, 2026
Hi @qveys! I'm Dosu and I’m helping the dokploy team.
You've correctly identified the root cause. The
configFilesfield is marked as.optional()in the Zod schema [1], and when the AI SDK converts this to a JSON Schema for OpenAI'sresponse_format, the field gets excluded from therequiredarray — which OpenAI's strict structured output mode rejects.The fix would be to change
configFilesfrom.optional()to.nullable()with a.default(null)or simply make it a required field defaulting to an empty array. For example:Option 2 is simpler and would also require no changes downstream since
configFilesis already handled with optional chaining in the UI components (from PR #2653). You'd just get an empty array instead ofundefined.This was introduced during the migration from
generateObjecttogenerateTextwithOutput.object()in PR #3718, which may have changed how the schema gets serialized to OpenAI's format.To reply, just mention @dosu.
Share context across your team and agents. Try Dosu.
Xariif commentedon May 21, 2026
It was fixed? Problem still occures for me - v0.29.4 gpt-4-turbo
ikaddabet commentedon May 25, 2026
Problem still occures for me - v0.29.5 gpt-4o
fix(ai): use nullable instead of optional for configFiles in AI sugge…
chore(release): 0.37.0 [skip ci]