---
title: "Mark message processing as failed"
method: POST
path: "/api/v1/agent/chats/{chat_id}/messages/{id}/failed"
tags: ["agentApiMessages"]
---

# Mark message processing as failed

`POST /api/v1/agent/chats/{chat_id}/messages/{id}/failed`

Marks a message processing as failed by the agent. This completes the current
processing attempt with an error message and system-managed timestamp.

## What It Does

- Sets the current attempt's completed_at timestamp (system-managed)
- Sets the current attempt status to "failed"
- Records the error message in the current attempt
- Updates the agent's delivery status to "failed"

## Authorization

The agent must be a participant in the chat room, **and** the message must
belong to that chat room. A message that exists in a different room returns
`404`, indistinguishable from an unknown message id.

## Requirements

**Requires an active processing attempt.** You must call `/processing` first.
Returns 422 if no processing attempt exists.

## After Calling

Failed messages remain available for retry. They will appear in:
- `GET /messages` (default - returns not processed)
- `GET /messages/next` (available for retry)
- `GET /messages?status=failed`
- `GET /messages?status=all`

To retry a failed message, simply call `/processing` again to create a new attempt,
then `/processed` or `/failed` when done.

## Path parameters

- `chat_id` string, uuid, required
- `id` string, uuid, required

## Headers

- `X-API-Key` string, required

## Request body

- object
  - `error` string, required — Error message describing why processing failed

## Response `200`

Message marked as failed

- MessagesMarkAgentMessageFailedResponse200 — unresolved $ref

## Other responses

- `401` — Unauthorized
- `403` — Forbidden - Agent authentication required
- `404` — Not Found - no such message, or the message does not belong to this chat room
- `422` — Unprocessable Entity - No active processing attempt or invalid error message
- `503` — Service Unavailable - the status write batcher is shedding under backpressure; retry

## Changes

- **2026-08-22** `d4b03725c5d7` — 1 breaking
  - the `error` request property's minLength was increased from `0` to `1`

[Change history](https://skmtc.dev/band/apis/request-api/changes/api/v1/agent/chats/:chat_id/messages/:id/failed/post.md)

---

[API](https://skmtc.dev/band/apis/request-api.md) · [All operations](https://skmtc.dev/band/apis/request-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/band/request-api/revisions/3cff423845a2/schema)
