bytedance/deer-flow · warning · HTTPException
Input text is required
Error message
Input text is required
What it means
Raised by POST /input-polish with status 400 when the request text, after stripping surrounding whitespace, is empty. The endpoint validates the normalized view of the input it would send to the model, so whitespace-only drafts (' ', '\n\t') are rejected identically to empty strings — preventing padded drafts from passing the check but wasting a model call.
Source
Thrown at backend/app/gateway/routers/input_polish.py:80
description="Rewrite a draft message before it is sent. This does not create a thread run or persist any message.",
)
@require_permission("runs", "create")
async def polish_input(
body: InputPolishRequest,
request: Request,
config: AppConfig = Depends(get_config),
) -> InputPolishResponse:
del request # Required by the auth decorator.
if not config.input_polish.enabled:
raise HTTPException(status_code=404, detail="Input polishing is disabled")
# Validate the same normalized view of the input that we send to the model,
# so the user-facing length boundary and the model input cannot disagree
# (e.g. a padded draft passing the check but arriving with stray whitespace).
text = body.text.strip()
if not text:
raise HTTPException(status_code=400, detail="Input text is required")
max_chars = config.input_polish.max_chars
if len(text) > max_chars:
raise HTTPException(status_code=400, detail=f"Input text exceeds {max_chars} characters")
model_name = config.input_polish.model_name
try:
raw = await run_oneshot_llm(
system_instruction=_build_system_instruction(),
user_content=_build_user_content(text, body.locale),
run_name="input_polish",
app_config=config,
model_name=model_name,
thread_id=body.thread_id,
)
rewritten = _clean_rewritten_text(raw)
except Exception as exc:
logger.exception("Failed to polish input: thread_id=%s err=%s", body.thread_id, exc)View on GitHub (pinned to 1dd6ba1acb)
Solutions
- Client-side check: trim the draft and skip the request when empty.
- Disable/gray out the polish control until the composer has non-whitespace text.
- Strip pasted content and validate before enqueueing the polish call.
Example fix
// before
if (draft.length > 0) await polish({ text: draft }); // ' ' passes -> 400
// after
const text = draft.trim();
if (text) await polish({ text }); Defensive patterns
Strategy: validation
Validate before calling
const text = draft.trim(); if (!text) return; // never call polish with empty/whitespace input
Type guard
const hasPolishableText = (s: string) => s.trim().length > 0;
Prevention
- Trim and check emptiness client-side before the request
- Disable the polish action on an empty composer
- Handle paste events by validating the resulting text
When it happens
Trigger: Sending {"text": ""}, {"text": " "}, or {"text": "\n"}; a polish button enabled on an empty composer; autosubmit logic firing before the user types.
Common situations: UI not disabling the polish action on empty input; whitespace left after the user deletes their message; paste of whitespace-only content.
Related errors
- Input text exceeds {max_chars} characters
- {e}
- Invalid provider ID
- Missing code or state parameter
- URL is required
AI-assisted analysis of bytedance/deer-flow@1dd6ba1acb (2026-08-14).
Data as JSON: /api/errors/fa7eebd6105a83c5.
Report an issue: GitHub.