Skip to content

fix: Display validation errors from catalog API responses #187

@jeff-schnitter

Description

@jeff-schnitter

Summary

When the catalog API returns a 400 error with validation violations, the CLI displays generic error messages instead of the actual validation details.

Current Behavior

HTTP Error 400: Unknown error - No details (Request ID: No request ID)

Expected Behavior

The CLI should display the validation violations returned by the API:

{
  "ok": false,
  "violations": [
    {
      "title": "Cortex Entity Relationships",
      "description": "Relationships of type 'geography' from 'united-states' cannot have sources of type 'service'.",
      "violationType": "MUST",
      "ruleLink": "https://docs.cortex.io/",
      "paths": ["/info//x-cortex-relationships"],
      "pointer": "/info//x-cortex-relationships",
      "startLine": 1,
      "endLine": 58
    }
  ]
}

Root Cause

The error handling in cortexapps_cli/cortex_client.py (lines 147-160) expects a specific JSON structure with message, details, and requestId fields, but validation errors use a violations array structure instead.

Proposed Solution

Update the error handling in CortexClient.request() to detect and format violations array responses in addition to the existing error format.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions