Skip to main content

Errors

FlowLayer V1 exposes a fixed protocol error-code set.

Error shapes in protocol flow

Errors can appear in three places:

  1. Protocol-level error message:
{
"type": "error",
"id": "cmd-42",
"payload": {
"code": "missing_name",
"message": "command.name is required"
}
}
  1. Rejected command ack (accepted: false):
{
"type": "ack",
"id": "cmd-42",
"payload": {
"accepted": false,
"error": {
"code": "unknown_service",
"message": "service \"billing\" is not defined"
}
}
}
  1. Failed result for an accepted command (ok: false):
{
"type": "result",
"id": "cmd-42",
"payload": {
"ok": false,
"error": {
"code": "internal_error",
"message": "..."
}
}
}

Error code catalog

CodeCategoryMeaning
invalid_jsonValidationIncoming frame is not valid JSON
missing_typeValidationtype is missing or empty
unknown_typeValidationtype is not recognized
missing_idValidationRequired id is missing
missing_nameValidationRequired name is missing
invalid_payloadValidation/command inputPayload shape or field values are invalid
unsupported_message_typeRoutingClient sent a message type that is not accepted as client input
unknown_commandRuntime command routingCommand name is not supported
unknown_serviceRuntime command validationReferenced service is not defined
service_busyRuntime stateService is currently transitioning (starting/stopping)
internal_errorRuntime executionServer failed while handling an accepted operation

Validation vs runtime behavior

Validation-layer failures (for example malformed envelope fields) are protocol errors.

Runtime command handling errors split in two patterns:

  • Immediate rejection via ack.accepted = false:
    • unknown_command
    • unknown_service
    • service_busy
    • command payload problems such as invalid payload.service or invalid get_logs parameters (invalid_payload)
  • Later failure via result.ok = false:
    • internal_error

Client reaction guidance

Code familyClient action
invalid_json, missing_*, unknown_type, invalid_payloadTreat as client-side request bug; fix request construction before retry
unsupported_message_typeEnsure client sends only command messages upstream
unknown_commandCheck hello.payload.capabilities; downgrade or guard unsupported actions
unknown_serviceRefresh service list from snapshot or get_snapshot, then retry with valid name
service_busyRetry later with backoff
internal_errorSurface error and allow retry; do not assume operation succeeded

Always correlate command outcomes by id when it is present.

See Message Envelopes for correlation details and WebSocket Lifecycle for session sequencing.