obsidian-languagetool-plugin icon indicating copy to clipboard operation
obsidian-languagetool-plugin copied to clipboard

Failed to make a request to the server LanguageTool

Open TrueVru opened this issue 1 year ago • 8 comments

Recently, problems with connecting to the LanguageTool server have started, I am users from Russia. Is it possible to solve this problem somehow? image

TrueVru avatar Apr 17 '23 12:04 TrueVru

You would have to check the logs what's actually happening.

Run the spell check so you get that error, then Go to Settings > Community Plugins > LanguageTool Integration > "Copy failed Request Logs" Then paste it here

Clemens-E avatar Apr 17 '23 15:04 Clemens-E

I copy the log file after the error, but for some reason it is not inserted anywhere. Pasted image 20230418090821

The following error is displayed in the developer console.

Pasted image 20230418090756 It is noteworthy that if I switch to a paid account, then everything works, although I do not have it.

Pasted image 20230418090950

TrueVru avatar Apr 18 '23 06:04 TrueVru

5/2/2023, 4:14:20 PM: url used for request: https://api.languagetool.org/v2/check Status: 400 Body: Error: You specified 'preferredVariants' but you didn't specify 'language=auto' Settings: {"serverUrl":"https://api.languagetool.org","urlMode":"standard","glassBg":false,"shouldAutoCheck":true,"pickyMode":false,"staticLanguage":"en","englishVeriety":"en-US","germanVeriety":"de-DE","portugueseVeriety":"pt-BR","catalanVeriety":"ca-ES","username":"REDACTED","apikey":"REDACTED"}

5/2/2023, 4:14:26 PM: url used for request: https://api.languagetool.org/v2/check Status: 400 Body: Error: You specified 'preferredVariants' but you didn't specify 'language=auto' Settings: {"serverUrl":"https://api.languagetool.org","urlMode":"standard","glassBg":false,"shouldAutoCheck":true,"pickyMode":false,"staticLanguage":"en","englishVeriety":"en-US","germanVeriety":"de-DE","portugueseVeriety":"pt-BR","catalanVeriety":"ca-ES","username":"REDACTED","apikey":"REDACTED"}

5/2/2023, 4:14:34 PM: url used for request: https://api.languagetool.org/v2/check Status: 400 Body: Error: You specified 'preferredVariants' but you didn't specify 'language=auto' Settings: {"serverUrl":"https://api.languagetool.org","urlMode":"standard","glassBg":false,"shouldAutoCheck":true,"pickyMode":false,"staticLanguage":"en","englishVeriety":"en-US","germanVeriety":"de-DE","portugueseVeriety":"pt-BR","catalanVeriety":"ca-ES","username":"REDACTED","apikey":"REDACTED"}

gabrielcarus avatar May 02 '23 20:05 gabrielcarus

You have a static language set, you can't have preferred variants and a static language

Clemens-E avatar May 03 '23 07:05 Clemens-E

It cannot connect either...

31/05/2023, 21:23:57: url used for request: https://api.languagetoolplus.com/v2/v2/check Status: 404 Body: Error: Unsupported action: 'v2/check'. Please see https://languagetool.org/http-api/swagger-ui/#/default Settings: {"serverUrl":"https://api.languagetoolplus.com/v2","urlMode":"premium","glassBg":true,"shouldAutoCheck":true,"pickyMode":true,"apikey":"REDACTED","username":"REDACTED","staticLanguage":"fr","englishVeriety":"en-GB","germanVeriety":"de-CH"}

31/05/2023, 21:26:36: url used for request: https://api.languagetool.org/v2/check Status: 400 Body: Error: Credentials provided, but server isn't configured to support this. Settings: {"serverUrl":"https://api.languagetool.org","urlMode":"standard","glassBg":true,"shouldAutoCheck":true,"pickyMode":true,"apikey":"REDACTED","username":"REDACTED","staticLanguage":"fr"}

agentlibre avatar May 31 '23 19:05 agentlibre

You have a static language set, you can't have preferred variants and a static language

You say "you can't". However, these are not my problems, it is the code you wrote that returns such errors. Perhaps the plugin does not interact with the API correctly? What is the correct way to interact with the API in the case of "staticLanguage"?

SecNotice avatar Jun 12 '23 07:06 SecNotice

It is the API that returns the error. LanguageTool can auto-detect the language, however the user above told it to use "en", while also telling it other languages it should prefer (e.g. when it detects German, it does not know if it's de_DE or de_CH, so you tell it you want de_CH). This can only be used when the language is set to auto-detect, which it isn't. The only thing the Plugin could do is not allow configuring it this way, or to silently drop settings without telling the user.

Clemens-E avatar Jun 12 '23 09:06 Clemens-E

Thanks to #96 it's not possible to select "auto-detect" and set a preferred language (and vice versa) thank you @lukeleppan

Clemens-E avatar Jul 01 '23 16:07 Clemens-E