GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Whitespace content causes API validation errors in provider transformations · Issue #8903 · anomalyco/opencode

Whitespace content causes API validation errors in provider transformations #8903

New issue
Copy link
New issue
Copy link
Closed
Closed
Whitespace content causes API validation errors in provider transformations#8903
Copy link
Assignees
thdxr

Description

@jerome-benoit
jerome-benoit
opened on Jan 16, 2026
Issue body actions

Problem

Provider APIs (Anthropic, OpenAI) reject requests containing empty or whitespace-only text content, causing validation failures during message transformation.

Current Behavior:

  • Untrimmed whitespace in message content passes through transformation functions
  • Empty strings after whitespace removal are sent to provider APIs
  • APIs respond with validation errors rejecting empty content blocks

Root Cause:
No consistent whitespace trimming or empty content filtering across provider transformation functions (anthropic.ts, openai.ts, openai-compatible.ts, transform.ts).

Impact

  • User messages with accidental whitespace cause request failures
  • Poor UX when legitimate content is rejected due to formatting
  • Inconsistent behavior across different providers

Proposed Solution

Implement consistent whitespace trimming pattern across all transformations:

const t = content.trim()
if (t.length > 0) {
  parts.push({ type: "text", text: t })
}

Scope:

  • Apply trimming to all text content before API submission
  • Filter empty/whitespace-only messages and parts
  • Preserve tool results and streaming deltas unchanged
  • Add comprehensive test coverage

Activity

  1. github-actions
    assigned
    thdxr
    on Jan 16, 2026
  2. github-actions commented on Jan 16, 2026

    @github-actions
    github-actionsBot
    on Jan 16, 2026 – with GitHub Actions
    Contributor
    More actions

    This issue might be a duplicate of existing issues. Please check:

    • TUI can auto-submit whitespace prompt, creating “empty user message” and breaking Claude/OpenAI-compatible proxies #8679: TUI can auto-submit whitespace prompt, creating "empty user message" and breaking Claude/OpenAI-compatible proxies
    • when (mistakenly) sending empty message the session stop with the error: text cannot be empty. #7493: when (mistakely) sending empty message the session stop with the error: text cannot be empty
    • Empty message content causes Anthropic API errors during compaction #6446: Empty message content causes Anthropic API errors during compaction (CLOSED)
    • Call Missing content in messages: text content blocks must be non-empty #5028: Call Missing content in messages: text content blocks must be non-empty (CLOSED)

    Feel free to ignore if none of these address your specific case.

  3. github-actions commented on Mar 26, 2026

    @github-actions
    github-actionsBot
    on Mar 26, 2026 – with GitHub Actions
    Contributor
    More actions

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

  4. github-actions
    closed this as completedon Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @thdxr
    thdxr

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

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.