HKUDS/DeepTutor · error · LLMConfigError

Cloud completion failed: no valid configuration

Error message

Cloud completion failed: no valid configuration

What it means

Defensive tail of _openai_complete: the response parsed successfully but no candidate carried textual content (content stayed None), so there is nothing to return and LLMConfigError is raised. In practice it means the endpoint returned a 200 body whose choices/message structure had no usable content field — an 'empty completion' from an OpenAI-compatible server.

Source

Thrown at deeptutor/services/llm/cloud_provider.py:452

                raise LLMAPIError(
                    f"Connection to {binding} API was forcibly closed. "
                    "This may indicate network issues or server-side problems. "
                    "Please check your internet connection and try again.",
                    status_code=0,
                    provider=binding or "openai",
                ) from e
            else:
                raise LLMAPIError(
                    f"Network error connecting to {binding} API: {e}",
                    status_code=0,
                    provider=binding or "openai",
                ) from e

    if content is not None:
        # Clean thinking tags from response using unified utility
        return clean_thinking_tags(content, binding, model)

    raise LLMConfigError("Cloud completion failed: no valid configuration")


async def _openai_stream(
    model: str,
    prompt: str,
    system_prompt: str,
    api_key: str | None,
    base_url: str | None,
    api_version: str | None = None,
    binding: str = "openai",
    messages: list[dict[str, object]] | None = None,
    **kwargs: object,
) -> AsyncGenerator[str, None]:
    """OpenAI-compatible streaming."""
    import json

    # Sanitize URL
    if base_url:

View on GitHub (pinned to 3e82f13042)

Solutions

  1. Log the raw response body once to see what the endpoint actually returned.
  2. Update/patch the local server (vLLM/LM Studio/Ollama) to a version with a conforming OpenAI schema.
  3. If tool-calls-only responses are expected, extend extraction to read tool_calls instead of content.
  4. Retry once — some backends intermittently emit empty candidates.
Defensive patterns

Strategy: retry

Validate before calling

# Cannot be validated client-side; mitigate by pinning known-good endpoints:
assert "v1" in (base_url or "https://api.openai.com/v1"), "use a conforming OpenAI-compatible base_url"

Try / catch

for attempt in range(2):
    try:
        return await complete(prompt=p, model=m)
    except LLMConfigError as e:
        if "no valid configuration" not in str(e) or attempt == 1:
            raise
        await asyncio.sleep(1)

Prevention

When it happens

Trigger: Local OpenAI-compatible servers (older vLLM/LM Studio/Ollama builds) returning choices[0].message without content; responses containing only tool_calls or refusal objects; prompt-engineered outputs where the model emitted only whitespace filtered upstream.

Common situations: Switching between OpenAI-compatible backends with divergent response schemas; server version change altering payload shape; requesting JSON mode and receiving an empty body; content filtered by a moderation layer.

Related errors


AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27). Data as JSON: /api/errors/b474d28b12a130ee. Report an issue: GitHub.