Significant-Gravitas/AutoGPT · warning · ValueError

Title must not be blank

Error message

Title must not be blank

What it means

A Pydantic ValidationError (HTTP 422) from the UpdateSessionTitleRequest model: the title field's title_must_not_be_blank validator strips the value and rejects any input that is empty or whitespace-only. The validator also normalizes: the returned value is the stripped title, so leading/trailing spaces never reach storage.

Source

Thrown at autogpt_platform/backend/backend/api/features/chat/routes.py:404

class CancelSessionResponse(BaseModel):
    """Response model for the cancel session endpoint."""

    cancelled: bool
    reason: str | None = None


class UpdateSessionTitleRequest(BaseModel):
    """Request model for updating a session's title."""

    title: str

    @field_validator("title")
    @classmethod
    def title_must_not_be_blank(cls, v: str) -> str:
        stripped = v.strip()
        if not stripped:
            raise ValueError("Title must not be blank")
        return stripped


class UpdateSessionPinnedRequest(BaseModel):
    """Request model for pinning/unpinning a session."""

    is_pinned: bool


# ========== Routes ==========


@router.get(
    "/sessions",
    dependencies=[Security(auth.requires_user)],
)
async def list_sessions(
    user_id: Annotated[str, Security(auth.get_user_id)],

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Validate client-side before the request: trim the title and require length >= 1.
  2. In the rename UI, disable the save button when the trimmed input is empty.
  3. Expect the stored title to be stripped — do not attempt to preserve leading/trailing whitespace through this endpoint.

Example fix

// before
await fetch(`/chat/sessions/${id}/title`, {method: 'PATCH', body: JSON.stringify({title: rawInput})})

// after
const title = rawInput.trim();
if (title) await fetch(`/chat/sessions/${id}/title`, {method: 'PATCH', body: JSON.stringify({title})})
Defensive patterns

Strategy: validation

Validate before calling

const title = rawTitle.trim();
if (!title) return; // don't PATCH
await updateTitle(sessionId, title);

Type guard

function isValidTitle(t: string): boolean {
  return t.trim().length > 0;
}

Prevention

When it happens

Trigger: PATCH /chat/sessions/{session_id}/title with body {"title": ""}, {"title": " "}, or {"title": "\t\n"}; also a client sending a title built from an unvalidated empty input field.

Common situations: Frontend form submitted without a required check on the title input; a 'rename' UI that allows saving with the textbox cleared; programmatic rename passing an untrimmed variable that is all whitespace.

Related errors


AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14). Data as JSON: /api/errors/b59bcf47ed357273. Report an issue: GitHub.