LINE error error_status_code: Webhook endpoint returned an error status
Last verified against LINE Developers - Messaging API reference (error responses)
error_status_codeWhat error error_status_code means
LINE delivered the webhook and got an answer, but the answer wasn't a success. The documented definition: "The LINE Platform sent a webhook to the bot server, but the bot server returned a response other than the HTTP status code in the 20x." The detail column contains the status code your server sent back.
The network path works; the problem is inside your HTTP stack, and the code points at the layer. A 404 or 405 means the request missed your handler (wrong path, or a GET-only route). A 401 or 403 usually comes from your own signature check or auth middleware. A 5xx means your code threw.
Signature checks deserve a special mention. LINE signs each webhook with your channel secret in the x-line-signature header, and the check must run over the raw request body. Frameworks that re-serialize JSON before you compute the HMAC change the bytes, so every signature fails and every delivery lands here.
What it looks like
// Test webhook endpoint response when your server answers 404
{
"success": false,
"timestamp": "2020-09-30T05:38:20.031Z",
"statusCode": 404,
"reason": "ERROR_STATUS_CODE",
"detail": "404"
}Why it happens
- The webhook URL path doesn't match a route in your app, so the server returns 404 or 405.
- Signature validation uses the parsed and re-serialized body instead of the raw bytes, or the wrong channel secret, and your code answers 400 or 401.
- An unhandled exception in an event handler bubbles up as a 500.
- An auth gateway, basic-auth prompt, or WAF in front of the app rejects LINE's request.
- Your handler errors on an empty events array, the shape LINE sends when you verify the URL.
How to fix LINE error error_status_code
- 1Read the status code in the detail column; it tells you which layer refused the request.
- 2Confirm the exact path in the console's Webhook URL matches your route and that the route accepts POST.
- 3Compute the signature over the raw body with the channel secret from the same channel, before any JSON parsing.
- 4Wrap each event handler so one failing event can't turn the whole delivery into a 500.
- 5Return 200 for a payload whose events array is empty; LINE uses that shape when you click Verify.
How to stop it recurring
Keep the webhook route boring: one POST handler, raw-body signature validation, and a top-level try/catch that logs the failure and still acknowledges the delivery when the event is unprocessable. Run the test webhook endpoint after every deploy. If you rely on redelivery, remember that a 5xx makes the event eligible again, so failures must be idempotent.
Official reference: LINE Developers - Messaging API reference (error responses). See all LINE error codes or the LINE limits and quotas.
Related codes
Error error_status_code - quick answers
What does LINE error error_status_code mean?
LINE delivered the webhook and got an answer, but the answer wasn't a success. The documented definition: "The LINE Platform sent a webhook to the bot server, but the bot server returned a response other than the HTTP status code in the 20x." The detail column contains the status code your server sent back. The network path works; the problem is inside your HTTP stack, and the code points at the layer.
How do I fix LINE error error_status_code?
1. Read the status code in the detail column; it tells you which layer refused the request. 2. Confirm the exact path in the console's Webhook URL matches your route and that the route accepts POST. 3. Compute the signature over the raw body with the channel secret from the same channel, before any JSON parsing. 4. Wrap each event handler so one failing event can't turn the whole delivery into a 500. 5. Return 200 for a payload whose events array is empty; LINE uses that…
Stop debugging LINE by hand
Connect the channel through Conferbot: tokens, webhooks and retries are handled, failures show as readable status.