LINE error could_not_connect: Webhook could not connect to your server
Last verified against LINE Developers - Messaging API reference (error responses)
could_not_connectWhat error could_not_connect means
This is a webhook delivery reason, not an API response. It appears in the Webhook errors tab of the LINE Developers Console (after you enable Error statistics aggregation) and in the reason field of the test webhook endpoint response. LINE's definition: "The LINE Platform tried to send a webhook to the bot server, but couldn't successfully connect to the bot server." Your code never saw the request.
The detail column says where the connection broke. Documented values include Connection timeout, DNS Query timeout, Unknown host, Invalid URL syntax, No SSL/TLS record (the server answered without TLS), and TLS handshake failure.
TLS is the usual culprit. LINE requires HTTPS with a certificate from a public certificate authority, accepts only TLS 1.2 and 1.3, and publishes the cipher suites it supports. Self-signed certificates, an incomplete certificate chain, TLS 1.1-only legacy load balancers, or a reverse proxy listening on plain HTTP all end up here. Your bot logic isn't involved yet.
What it looks like
// POST /v2/bot/channel/webhook/test - bot server TLS settings rejected
{
"success": false,
"timestamp": "2023-07-07T04:29:51.043124Z",
"statusCode": 0,
"reason": "COULD_NOT_CONNECT",
"detail": "TLS handshake failure: https://example.com/webhook"
}Why it happens
- The certificate is self-signed, expired, or missing its intermediate chain, giving TLS handshake failure.
- The server only negotiates TLS 1.1 or lower, or none of the cipher suites LINE supports.
- The webhook URL points at an http listener or a port that doesn't speak TLS, giving No SSL/TLS record.
- The hostname doesn't resolve publicly (Unknown host, DNS Query timeout), often a private or tunnel hostname that has expired.
- A firewall, security group, or WAF drops inbound connections from the internet.
How to fix LINE error could_not_connect
- 1Open the Webhook errors tab in the console and read the detail value; it names the exact stage that failed.
- 2Call POST /v2/bot/channel/webhook/test; the response repeats reason and detail, for example "TLS handshake failure: https://example.com/webhook".
- 3Check the certificate from outside your network (openssl s_client -servername) and confirm the full chain is served.
- 4Compare your server's protocols and ciphers with LINE's SSL/TLS specification of the webhook source and enable TLS 1.2 or 1.3 with a supported suite.
- 5Confirm the hostname resolves publicly and the port is reachable from the internet, not just your VPN.
How to stop it recurring
Use a certificate from a public CA with automated renewal, and monitor its expiry date separately from the app. Add the test webhook endpoint to your post-deploy checks so a TLS or DNS regression fails the release instead of silently dropping user messages. Keep Error statistics aggregation switched on in production; it only records errors while it is enabled and won't backfill.
Official reference: LINE Developers - Messaging API reference (error responses). See all LINE error codes or the LINE limits and quotas.
Related codes
Error could_not_connect - quick answers
What does LINE error could_not_connect mean?
This is a webhook delivery reason, not an API response. It appears in the Webhook errors tab of the LINE Developers Console (after you enable Error statistics aggregation) and in the reason field of the test webhook endpoint response. LINE's definition: "The LINE Platform tried to send a webhook to the bot server, but couldn't successfully connect to the bot server." Your code never saw the request.
How do I fix LINE error could_not_connect?
1. Open the Webhook errors tab in the console and read the detail value; it names the exact stage that failed. 2. Call POST /v2/bot/channel/webhook/test; the response repeats reason and detail, for example "TLS handshake failure: https://example.com/webhook". 3. Check the certificate from outside your network (openssl s_client -servername) and confirm the full chain is served. 4. Compare your server's protocols and ciphers with LINE's SSL/TLS specification of the webhook…
Stop debugging LINE by hand
Connect the channel through Conferbot: tokens, webhooks and retries are handled, failures show as readable status.