Skip to content

[Bug] Provider Returns 'messages field is required' - Empty Request Body #646

Description

@easonLiangWorldedtech

Bug: Provider Returns "messages field is required" - Empty Request Body (LiteLLM & LM Studio)

Problem Description

When using LiteLLM or LM Studio (OpenAI Compatible) provider in Roomote, some inference requests fail with error:

The provider returned an error: Bad Request: 'messages' field is required

This affects both LiteLLM and LM Studio providers — the issue is not limited to one provider type.

Root Cause Analysis

Issue 1: URL Path Duplication (Intermittent)

  • LITELLM_BASE_URL default value in docker-compose.fixed.yml: http://roomote-proxy:4000/v1 (includes trailing /v1)
  • Roomote inference gateway appends upstreamPath (v1/chat/completions) to base URL
  • Result: Some requests go to http://roomote-proxy:4000/v1v1/chat/completions

Issue 2: Empty Request Body (Critical)

Proxy logs show that some /v1/chat/completions requests have empty body:

[PROXY] POST /v1/chat/completions
[PROXY] Headers: Content-Type=application/json, Authorization=True
[PROXY] Request body keys: []
[PROXY] WARNING: 'messages' field missing! Full body: {}
[PROXY] LM Studio error 400: {"error":"'messages' field is required"}

Proxy Log Evidence (Three Patterns)

Pattern 1: Correct URL + Body OK → 200 ✓

[PROXY] POST /v1/chat/completions
[PROXY] Request body keys: ['model', 'messages', 'max_tokens']
"POST /v1/chat/completions HTTP/1.1" 200 -

Pattern 2: URL Duplication + Body OK → 200 ✓ (LM Studio accepts it)

[PROXY] POST /v1/v1/chat/completions
[PROXY] Request body keys: ['model', 'messages', 'max_tokens']
"POST /v1/v1/chat/completions HTTP/1.1" 200 -

Pattern 3: Correct URL + Empty Body → 400 ✗ (FAILS)

[PROXY] POST /v1/chat/completions
[PROXY] Request body keys: []
[PROXY] WARNING: 'messages' field missing! Full body: {}
"POST /v1/chat/completions HTTP/1.1" 400 -

Fix Applied (Partial)

Changed .env file:

  • Before: LITELLM_BASE_URL=http://roomote-proxy:4000/v1
  • After: LITELLM_BASE_URL=http://roomote-proxy:4000 (removed trailing /v1)

Current Status

After restarting services, proxy still shows Pattern 3 failures. The root cause of empty request body is unknown — likely a bug in Roomote's inference gateway when using litellm or LM Studio provider.

Important: This issue affects both LiteLLM and LM Studio (OpenAI Compatible) providers, not just LiteLLM.

Expected Behavior

  • All requests should have ['model', 'messages', ...] fields in request body
  • Response status should be 200

Environment

  • Self-hosted Roomote via Docker Compose
  • Source: /tmp/roomote-setup-latest/ (commit 222a1cb)
  • Deploy config: /tmp/roomote-setup/deploy/compose/docker-compose.fixed.yml
  • LM Studio: http://host.docker.internal:1234
  • LiteLLM proxy container: roomote-roomote-proxy-1 (port 4000)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions