Skip to content

Make every tool-reachable error name its field and a next step #227

Description

@HMarzban

Problem

An agent recovers from a failure by reading the error. Most docs.plus errors do not say enough to recover from.

Measured: 148 sites return an ad-hoc c.json({ error: '...' }) against 58 that call the house fail(c, ...) helper. Ten of the ad-hoc sites sit in the core document controller, not in the email or admin corners that apps/hocuspocus.server/API.md:73 names.

A validation failure names no field. A well-formed body and a nonsense body both return the same thing:

{"success":false,"error":{"message":"Request validation failed","code":"VALIDATION_ERROR"}}

A person opens API.md and squints. An agent cannot, so it retries the same wrong call.

What to do

Wire the house envelope across the ad-hoc sites, starting with the ten in apps/hocuspocus.server/src/api/controllers/documents.controller.ts.

Make each validation failure name the field that failed and the next step.

Acceptance

  • Every tool-reachable failure returns the house envelope with a specific code.
  • A validation failure names the offending field.
  • The import route's shape is the model to copy: it already answers Expected a file in the 'documentFile' field.

Notes

This is a gate, not tidiness. Connector directory review rejects a generic error, and requires every tool to return a successful response for valid parameters.

The 429 path already does this correctly. It uses the house envelope and sets Retry-After, and it is the one error an agent can handle today.

Scope this to the tool-reachable surface. A full sweep of all 148 sites is a separate job.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions