open-webui/open-webui · error · HTTPException

ERROR_MESSAGES.DEFAULT()

Error message

ERROR_MESSAGES.DEFAULT()

What it means

Catch-all 400 from the user chat-list endpoint (GET /api/v1/chats/ with pagination/sort params). Any exception while querying or post-processing the list — invalid query parameter combinations, DB session failure — is logged and converted to this generic 400.

Source

Thrown at backend/open_webui/routers/chats.py:259

                sort_by=sort_by,
                sort_dir=sort_dir,
                skip=skip,
                limit=limit,
                db=db,
            )
        else:
            chats = await Chats.get_chat_title_id_list_by_user_id(
                user.id,
                include_folders=include_folders,
                include_pinned=include_pinned,
                sort_by=sort_by,
                sort_dir=sort_dir,
                db=db,
            )
        return await add_active_state_to_chat_list(request, chats)
    except Exception as e:
        log.exception(e)
        raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail=ERROR_MESSAGES.DEFAULT())


@router.post('/read')
async def mark_chats_read_by_user_id(
    user=Depends(get_verified_user),
    db: AsyncSession = Depends(get_async_session),
):
    return {
        'updated_count': await Chats.mark_chats_read_by_user_id(user.id, db=db),
        'folder_unread_counts': await get_folder_unread_counts(user.id, db=db),
    }


############################
# GetChatUsageStats
# EXPERIMENTAL: may be removed in future releases
############################

View on GitHub (pinned to 01f4282f1f)

Solutions

  1. Inspect the server log line produced by log.exception(e) — the response itself carries no cause
  2. Simplify the request to bare GET /api/v1/chats/ and re-add parameters one at a time to find the offender
  3. Validate page >= 1 and known sort_by/sort_dir enum values on the client
  4. If bare calls also fail, investigate database health rather than parameters
Defensive patterns

Strategy: try-catch

Validate before calling

const clamp = (v, lo, hi) => Math.min(Math.max(Number(v) || lo, lo), hi);
params.page = clamp(params.page, 1, 1e6);

Try / catch

catch (e) { if (e.status === 400) { logTimeForServerTrace(); retryWithBareParams(); } else throw e; }

Prevention

When it happens

Trigger: Calling the chat list with malformed sort_by/sort_dir/include_pinned/include_folders values, or a page/size the handler mishandles; DB connectivity errors during the listing query.

Common situations: Client upgraded and sending new sort params an older backend rejects; negative or zero page values; transient DB outage making every list call fail this way.

Related errors


AI-assisted analysis of open-webui/open-webui@01f4282f1f (2026-08-14). Data as JSON: /api/errors/6d3003f1bbf0c35a. Report an issue: GitHub.