Skip to content

Error Handling

Error Response Format

All errors are returned in the following JSON format.

{ "error": "<message>" }

400 Bad Request

Returned when request parsing or validation fails. No data is written to S3.

Cause Condition
log_id missing Field is empty or absent
generated_at missing Field is empty or absent
generated_at invalid format Value that cannot be parsed as a Unix timestamp (integer)
prompt missing Field is empty or absent
image missing image field is not present

500 Internal Server Error

Returned when writing to S3 fails.

Cause Condition
prompt.json save failure S3 PutObject returned an error
image.jpg save failure S3 PutObject returned an error

Design Notes

  • S3 writes are executed sequentially in the order prompt.json โ†’ image.jpg. If writing prompt.json fails, processing stops immediately and image.jpg is not written.
  • No retries are performed. An S3 error immediately returns 500.
  • generated_at is received as a Unix timestamp (integer seconds since epoch), converted to UTC, and used for the date portion of the S3 path ({yyyy}/{mm}/{dd}).