meshery / meshery/meshkit

CategoryFilter.Get swallows database errors and returns an empty result as success

Open
#1,075 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
223
Forks
225
Avg merge
7d 1h
Merged PRs (30d)
1

Description

### Current Behavior

`CategoryFilter.Get` (`models/meshmodel/registry/v1beta1/category_filter.go`) drops the error from the DB query and returns a successful-looking empty result:

```go
err := finder.Find(&catdb).Error
if err != nil {
return cat, count, int(count), nil // error dropped, nil returned
}
```

Every sibling filter propagates the error instead. `ModelFilter.Get` (`model_filter.go`):

```go
err := finder.Find(&modelWithCategories).Error
if err != nil {
return nil, 0, 0, err
}
```

`ConnectionFilter.Get` does the same. `CategoryFilter` is the only outlier.

### Consequence

Any real `Find` failure — a bad `OrderOn` column from a caller-supplied sort param producing a SQL error, or a transient DB error — is reported as **HTTP 200 with an empty category list**, with nothing surfaced to the client and nothing logged. The two `GetMeshmodelCategories*` handlers in meshery also discard the error (`categories, count, _, _ := ...`), so the failure is invisible end to end.

### Desired Behavior

Propagate the error like the sibling filters do (`return nil, 0, 0, err`).

I have the one-line fix ready (GOOS=linux build + vet pass) and will open a PR referencing this issue.

Contributor guide

Open the contributing guide

Research direction

Start in models/meshmodel/registry/v1beta1/category_filter.go and compare CategoryFilter.Get with model_filter.go and the connection filter. Run the stated GOOS=linux build and vet checks; done means database query failures are propagated rather than returned as a successful empty result.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, database
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.