Skip to content

POST /api/v1/automation answers 500 INTERNAL_ERROR for a malformed flow body — including the #4277 undeclared-config-key refusal the #7545 ruling leans on #8055

Description

@baozhoutao

Same error-class mismatch #7535 just fixed on the sibling POST /automation/:name/toggle route.

Symptom

Four distinct malformed registration bodies, all answered 500 INTERNAL_ERROR where 400 is the right class. Reproduced 2×:

  1. A node missing label → 500 carrying a raw zod issue array: {expected:'string', code:'invalid_type', path:['nodes',0,'label']}
  2. An unknown node key → 500 {code:'unrecognized_keys', keys:['next'], path:['nodes',0]}
  3. A malformed try_catch region → 500 "try_catch 'g' try: invalid region — Invalid input: expected object, received array"
  4. The important one — an undeclared node config key → 500:

    Flow 'x' rejected: 1 undeclared config key(s) (#4277). - node 'n' (notify): unknown config key \totallyBogusKey` at config.totallyBogusKey. It is not declared by this node type's configSchema…`

Expected 400 VALIDATION_FAILED with an ADR-0114 details.fields[], as the sibling /toggle route now returns and as the descriptor routes return.

Contrast controls run in the same pass: a well-formed body still registers 200, and the unknown-flow toggle correctly answers 404 RESOURCE_NOT_FOUND. So the catch arm on this one handler is mapping caller-input refusals to INTERNAL_ERROR.

The substance is fine — only the class and the message shape are wrong

The #7545 premise still holds: the refusal is hard and is located. Case 4 in particular produces exactly the self-correcting message #4277 designed. It is delivered under an HTTP status that says the opposite.

Impact — the one #7535 spelled out

An authoring client with retry-on-5xx will retry a request that can never succeed. And an agent authoring a flow reads "the server broke" instead of "your metadata is wrong" — the inverse of the self-correcting shape #4277 chose. Case 1 additionally leaks a raw zod issue array where the house envelope belongs.

Severity

P3.

Source

Found by the platform checklist retest of automation.flow-node-type-matrix (framework 279ee48a), while verifying the #7545 ruling. Held no clause of that item.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions