Control UI WebSocket Image Upload Size Limit Too Small (5MB Hardcoded)
Problem Description
The Control UI uses WebSocket chat.send to upload images, but there's a hardcoded 5MB limit (maxBytes: 5e6) in the WebSocket handler that cannot be configured. This is too restrictive for many use cases.
Current Behavior
- Control UI image uploads via WebSocket
chat.send are limited to 5MB
- The limit is hardcoded in
/app/dist/gateway-cli-ape0pnBU.js in the agentHandlers.agent function
- The
gateway.http.endpoints.responses.images.maxBytes configuration only applies to HTTP /v1/responses endpoint, not WebSocket
Expected Behavior
Allow configuration of WebSocket image upload size limit via openclaw.json, similar to how HTTP endpoints can be configured.
Code Location
The hardcoded limit is in the WebSocket handler:
// In agentHandlers.agent function
const parsed = await parseMessageWithAttachments(message, normalizedAttachments, {
maxBytes: 5e6, // <-- Hardcoded 5MB limit
log: context.logGateway
});
The parseMessageWithAttachments function already supports opts.maxBytes parameter, but the caller doesn't read from config.
Proposed Solution
-
Add a configuration path in openclaw.json:
{
"gateway": {
"http": {
"endpoints": {
"chatCompletions": {
"enabled": true,
"images": {
"maxBytes": 104857600 // 100MB, or user-defined
}
}
}
}
}
}
-
Modify the WebSocket handler to read from config:
const imageMaxBytes = cfg?.gateway?.http?.endpoints?.chatCompletions?.images?.maxBytes
?? cfg?.gateway?.http?.endpoints?.responses?.images?.maxBytes
?? 5e6; // Fallback to 5MB if not configured
const parsed = await parseMessageWithAttachments(message, normalizedAttachments, {
maxBytes: imageMaxBytes,
log: context.logGateway
});
Workaround
Currently, users can:
- Use HTTP
/v1/responses endpoint (which respects gateway.http.endpoints.responses.images.maxBytes)
- Upload images to image hosting services and provide URLs
- Modify compiled code in container (temporary, lost on restart)
Environment
- OpenClaw version: 2026.2.4 (based on container)
- Platform: Docker container
- Control UI: WebSocket-based chat interface
Additional Context
- The HTTP
/v1/responses endpoint already supports configurable image size limits
- This would make WebSocket behavior consistent with HTTP endpoints
- The
parseMessageWithAttachments function already supports the maxBytes parameter, so the change should be minimal
Related
- This issue is related to Control UI functionality
- Similar to HTTP endpoint configuration but for WebSocket
Note: I searched existing issues and didn't find any discussion about this specific WebSocket image upload limit. If there's a related issue, please let me know!
Control UI WebSocket Image Upload Size Limit Too Small (5MB Hardcoded)
Problem Description
The Control UI uses WebSocket
chat.sendto upload images, but there's a hardcoded 5MB limit (maxBytes: 5e6) in the WebSocket handler that cannot be configured. This is too restrictive for many use cases.Current Behavior
chat.sendare limited to 5MB/app/dist/gateway-cli-ape0pnBU.jsin theagentHandlers.agentfunctiongateway.http.endpoints.responses.images.maxBytesconfiguration only applies to HTTP/v1/responsesendpoint, not WebSocketExpected Behavior
Allow configuration of WebSocket image upload size limit via
openclaw.json, similar to how HTTP endpoints can be configured.Code Location
The hardcoded limit is in the WebSocket handler:
The
parseMessageWithAttachmentsfunction already supportsopts.maxBytesparameter, but the caller doesn't read from config.Proposed Solution
Add a configuration path in
openclaw.json:{ "gateway": { "http": { "endpoints": { "chatCompletions": { "enabled": true, "images": { "maxBytes": 104857600 // 100MB, or user-defined } } } } } }Modify the WebSocket handler to read from config:
Workaround
Currently, users can:
/v1/responsesendpoint (which respectsgateway.http.endpoints.responses.images.maxBytes)Environment
Additional Context
/v1/responsesendpoint already supports configurable image size limitsparseMessageWithAttachmentsfunction already supports themaxBytesparameter, so the change should be minimalRelated
Note: I searched existing issues and didn't find any discussion about this specific WebSocket image upload limit. If there's a related issue, please let me know!