Skip to content

Control UI WebSocket Image Upload Size Limit Too Small (5MB Hardcoded) #11563

@Digihankie

Description

@Digihankie

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

  1. Add a configuration path in openclaw.json:

    {
      "gateway": {
        "http": {
          "endpoints": {
            "chatCompletions": {
              "enabled": true,
              "images": {
                "maxBytes": 104857600  // 100MB, or user-defined
              }
            }
          }
        }
      }
    }
  2. 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:

  1. Use HTTP /v1/responses endpoint (which respects gateway.http.endpoints.responses.images.maxBytes)
  2. Upload images to image hosting services and provide URLs
  3. 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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions