Skip to content

API: return descriptive error bodies for filter/validation errors #6467

Open

Description

@otavio

Context

Follow-up to #3523 / #6466.

That PR makes malformed filter query params return a consistent 400 instead of a cryptic 500, but the response body stays empty — consistent with the API's current convention, where the central error handler (api/pkg/echo/handlers/errors.go) renders every error as c.NoContent(status) (it even strips echo.HTTPError messages). So clients get a status code but no explanation of what was wrong with the filter.

Proposal

Introduce a standard JSON error envelope (e.g. {"error": "...", "code": "..."}) emitted by the central error handler, so filter/validation failures (and errors generally) carry a human-readable description — e.g. filter is not valid base64, filter exceeds the maximum size, unknown filter operator. The query package already returns classified sentinels (ErrFilterInvalid, ErrFilterTooLarge) and routes/errors has an ErrDataInvalidEntity{Fields} shape to build on.

This is a contract-wide change (touches every endpoint's error responses and the OpenAPI 400/4xx response schemas), which is why it was deferred from #3523 rather than done piecemeal on the filter routes.

Acceptance

  • A standard error body schema, documented in OpenAPI (the 400 components currently have no schema).
  • Backward-compatible rollout (clients checking status codes unaffected).

Activity

  1. geovannewashington commented on Sep 8, 2026

    @geovannewashington
    Member

    Half of this is already done. #6916 (closing #6915, merged 18 Aug) added the JSON error envelope and the apiError.yaml schema, so both acceptance criteria here were already met before I started.

    What was left is the wording. Filter rejections arrived in the envelope but said "is not valid" or "cannot be decoded" for nine different mistakes, and cloud's list routes answered a bare 400 with no body at all. That is what the linked PR fixes.

  2. added a commit that references this issue on Sep 28, 2026
    0636a52
  3. added 13 commits that reference this issue on Oct 15, 2026
    ede3caf
    010928a
    03e8d40
    569201b
    219206b
    bf5b637
    38d161e
    d0247ed
    ba08e0b
    77996a8
    3d8e179
    5a20e1b
    09fb36d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

apiv2Planned for API v2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions