Skip to content

fix(ui): show empty state when no model configs exist (#1930)#1944

Merged
peterj merged 2 commits into
kagent-dev:mainfrom
gauravshinde1729:fix/ui-empty-modelconfigs
May 29, 2026
Merged

fix(ui): show empty state when no model configs exist (#1930)#1944
peterj merged 2 commits into
kagent-dev:mainfrom
gauravshinde1729:fix/ui-empty-modelconfigs

Conversation

@gauravshinde1729
Copy link
Copy Markdown
Contributor

@gauravshinde1729 gauravshinde1729 commented May 29, 2026


Title:
fix(ui): show empty state when no model configs exist (#1930)

Description:

What

When no ModelConfig resources are deployed, the UI showed a
"Failed to fetch models" error instead of rendering the normal empty
state ("no agents yet" / empty models page).

Fixes #1930

Why

The backend's StandardResponse.Data field uses json:"data,omitempty",
so an empty list serializes with the data field omitted entirely
(e.g. {"error":false,"message":"Successfully listed ModelConfigs"}),
returned with HTTP 200.

The UI treated a missing data as a fetch failure:

if (!response.data || response.error) {
  throw new Error(response.error || "Failed to fetch models");
}

So a valid "zero model configs" response was misread as an error and
surfaced via the shared error state in AgentsProvider (and on the
/models page).

Change

Treat a missing/empty list as a valid empty result, and only fail on an
explicit response.error — matching the existing defensive pattern in
AgentList (result.data || []):

  • ui/src/components/AgentsProvider.tsx — fetchModels
  • ui/src/app/models/page.tsx — fetchModels

This is a frontend-only fix; the backend omitempty behavior is
unchanged.

Screenshots

Before:

Screenshot 2026-05-29 225451

After:

image

Signed-off-by: gauravshinde1729 <shindegauravpict@gmail.com>
Copilot AI review requested due to automatic review settings May 29, 2026 17:41
@gauravshinde1729 gauravshinde1729 requested a review from peterj as a code owner May 29, 2026 17:41
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels May 29, 2026
Signed-off-by: gauravshinde1729 <shindegauravpict@gmail.com>
@peterj peterj merged commit 1dec305 into kagent-dev:main May 29, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug]: error listing agents (in the UI) when there are no models

2 participants