https://bugs.documentfoundation.org/show_bug.cgi?id=174490

            Bug ID: 174490
           Summary: LanguageTool: misleading “Could not establish Internet
                    connection” error for HTTP responses
           Product: LibreOffice
           Version: 26.2.7.3 release
          Hardware: All
                OS: Linux (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: LibreOffice
          Assignee: [email protected]
          Reporter: [email protected]

Description:
### Problem

When the built-in LanguageTool grammar checker receives an HTTP error response
from the LanguageTool API, LibreOffice displays the following message:

> Could not establish Internet connection to 
> https://api.languagetool.org/v2/check. Client error message: (22) HTTP 
> response code said error

This is misleading because it seems to report an inability to establish an
Internet connection, even when DNS resolution, TCP connectivity, TLS
negotiation and HTTP communication have succeeded.

### Actual behavior

The error message might suggest a network connectivity problem, without
exposing the actual HTTP response or explaining why the request failed.

In my case, inspecting the request through mitmproxy showed the following:

**Server response headers:**

```text
date:                           Sat, 14 Nov 2026 18:52:03 GMT
access-control-allow-origin:    *
content-length:                 197
x-envoy-upstream-service-time:  83
server:                         istio-envoy
x-backend-server:               gcp_k8s_service_24
x-request-id:                  
933A:00000000000000000000FFFF5B63BBEC:01BB:6AF8ADD3:D46A65:1EE99F
strict-transport-security:      max-age=63072000
```

**LanguageTool response body:**

```text
Error: Text checking was stopped due to too many errors
(more than 60% of words seem to have an error).
Are you sure you have set the correct text language?
Language set: Italian, text length: 1094
```

**Server connection:**

```text
Address           api.languagetool.org:443
Resolved Address  91.99.187.236:443
HTTP Version      HTTP/2.0
ALPN              h2
```

**Server certificate:**

```text
Type           RSA, 2048 bits
SHA256 digest  bf 86 6f 97 c5 9e 27 65 da 9b d5 54 da 6a 9f 5b 77 50 71 28 33
c2 80 35 77 91 59 4f f2 05 77 f2
Valid from     2026-11-13 05:44:57+00:00
Valid to       2027-02-11 04:44:56+00:00
Subject        CN api.languagetool.org
Issuer         C=US, O=Let's Encrypt, CN=YR1
Alt names      api.languagetool.org
```

**Client connection:**

```text
Address                 127.0.0.1:48844
HTTP Version            HTTP/2.0
TLS Version             TLSv1.3
Server Name Indication  api.languagetool.org
Cipher Name             TLS_AES_256_GCM_SHA384
ALPN                    h2
```

**Connection timing:**

```text
Client conn. established    19:52:03.660
Server conn. initiated      19:52:03.662
Server conn. TCP handshake  19:52:03.701
Server conn. TLS handshake  19:52:03.745
Client conn. TLS handshake  19:52:03.747
First request byte          19:52:03.748
Request complete            19:52:03.749
First response byte         19:52:03.897
Response complete           19:52:03.898
Client conn. closed         19:52:03.899
Server conn. closed         19:52:03.899
```

As you can see the actual response body is more clear that what LO UI shows:

Error: Text checking was stopped due to too many errors
(more than 60% of words seem to have an error).
Are you sure you have set the correct text language?
Language set: Italian, text length: 1094

This is due to some issues of setting correctly language for document or parts
of the document text.



### Environment

- OS: Fedora Linux
- LibreOffice: libreoffice-26.2.7.3-1.fc44.x86_64
- Built-in LanguageTool integration
- API endpoint: `https://api.languagetool.org/v2/check`

### Additional diagnostic information

The request successfully establishes TCP and TLS connections and receives an
HTTP response. The reported libcurl error is error 22
(`CURLE_HTTP_RETURNED_ERROR`), which indicates an HTTP response error rather
than a connection-establishment failure.

The current error message hides the most useful diagnostic information and
sends users investigating DNS, proxy and TLS configuration when the actual
failure may be an HTTP-level or LanguageTool application-level response.

Steps to Reproduce:
1. a text (I had that in a table column) was set to Italian, although it is in
fact English text
2. when the LO opens such a document the error (see below) appears

Actual Results:
Could not establish Internet connection to
https://api.languagetool.org/v2/check. Client error message: (22) HTTP response
code said error

>From MITMproxy:

2026-11-14 20:18:54 POST https://api.languagetool.org/v2/check HTTP/2.0         
                         ← 400 196b 204ms
                                Request                                        
                      Response                                                 
              Detail
user-agent:      LibreOffice 26.2.7.3 denylistedbackend/8.18.0 OpenSSL/3.5.9    
accept:          */*                                                            
content-length:  1209                                                           
content-type:    application/x-www-form-urlencoded                              
URL-encoded                                                                    
                                                                               
                                            [m:auto]
text: 'In terms of the...
language: it

---

2026-11-14 20:18:54 POST https://api.languagetool.org/v2/check HTTP/2.0         
                         ← 400 196b 204ms
                                Request                                        
                      Response                                                 
              Detail
date:                           Sat, 14 Nov 2026 19:18:54 GMT                   
access-control-allow-origin:    *                                               
content-length:                 196                                             
x-envoy-upstream-service-time:  97                                              
server:                         istio-envoy                                     
x-backend-server:               gcp_k8s_service_30                              
x-request-id:                  
E3E0:00000000000000000000FFFF5B637479:01BB:6AF8B41E:DA8251:24061B               
strict-transport-security:      max-age=63072000                                
Raw                                                                            
                                                                               
                                            [m:auto]
Error: Text checking was stopped due to too many errors (more than 60% of words
seem to have an error). Are you sure you have set the correct text language?
Language set: Italian, text length: 868

Expected Results:
LibreOffice should distinguish between:

- Network connectivity failures (DNS resolution, TCP connection, TLS
handshake).
- HTTP errors (4xx/5xx), ideally displaying the HTTP status code and relevant
response message.
- LanguageTool application-level errors, such as unsupported or incorrectly
detected text languages.

At a minimum, an HTTP response error should not be reported as an inability to
establish an Internet connection.### Expected behavior

LibreOffice should distinguish between:

- Network connectivity failures (DNS resolution, TCP connection, TLS
handshake).
- HTTP errors (4xx/5xx), ideally displaying the HTTP status code and relevant
response message.
- LanguageTool application-level errors, such as unsupported or incorrectly
detected text languages.

At a minimum, an HTTP response error should not be reported as an inability to
establish an Internet connection.LibreOffice should distinguish between:

- Network connectivity failures (DNS resolution, TCP connection, TLS
handshake).
- HTTP errors (4xx/5xx), ideally displaying the HTTP status code and relevant
response message.
- LanguageTool application-level errors, such as unsupported or incorrectly
detected text languages.

At a minimum, an HTTP response error should not be reported as an inability to
establish an Internet connection.


Reproducible: Sometimes


User Profile Reset: No

Additional Info:
n/a

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to