Skip to content

fix: [AIPLAT-1344]: Surface NG error details in API failures - #841

Merged
thisrohangupta merged 1 commit into
harness:mainfrom
madhav-harness:AIPLAT-1344-ng-error-details
Aug 20, 2026
Merged

fix: [AIPLAT-1344]: Surface NG error details in API failures#841
thisrohangupta merged 1 commit into
harness:mainfrom
madhav-harness:AIPLAT-1344-ng-error-details

Conversation

@madhav-harness

@madhav-harness madhav-harness commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Description

NG error bodies often put the real cause in details, detailedMessage, or responseMessages while message is only a generic string such as Unable to process JSON. Agents then cannot tell what to fix.

This change appends those extra fields onto HarnessApiError.message when they add new information, de-duplicates repeats, and truncates oversized detail. The same enrichment applies to request and requestStream.

Verified against QA POST /ng/api/connectors with a K8s InheritFromDelegate body that still carries credential.spec. NG returns 400; nothing is created.

Request

POST /ng/api/connectors?accountIdentifier=<account>
{
  "connector": {
    "name": "mcp_err_probe_spec",
    "identifier": "mcp_err_probe_spec",
    "type": "K8sCluster",
    "spec": {
      "credential": {
        "type": "InheritFromDelegate",
        "spec": {}
      },
      "delegateSelectors": ["any-delegate"]
    }
  }
}

NG response

{
  "code": 400,
  "message": "Unable to process JSON",
  "details": "No spec should be provided with the inherit from delegate type"
}

Before

Unable to process JSON

After

Unable to process JSON — No spec should be provided with the inherit from delegate type

correlationId and other envelope fields stay on HarnessApiError and are not copied into message. If responseMessages only repeats message, the string is unchanged.

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other

Checklist

  • pnpm test passes
  • pnpm typecheck passes
  • pnpm build passes
  • pnpm standards:check passes (architecture guardrails — see [docs/coding-standards.md](docs/coding-standards.md))
  • pnpm docs:check passes (if registry/tool counts changed)

Coding Standards (registry-driven MCP model)

If this PR adds or changes Harness API coverage:

  • No new server.registerTool() calls — only toolset definitions in src/registry/toolsets/
  • Toolset registered in ALL_TOOLSETS and ToolsetName union
  • operationPolicy on every new/changed endpoint
  • Shared response extractors from src/registry/extractors.ts (no raw passthrough on real endpoints)
  • identifierFields and scope declared on new resources
  • No console.log() in src/ (stdio JSON-RPC safety)

N/A — client error parsing only; no registry/toolset changes.

Append details, detailedMessage, and extra responseMessages to the client error so agents see the real cause instead of only Unable to process JSON.
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@thisrohangupta
thisrohangupta merged commit 0268367 into harness:main Aug 20, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants