JOSM upload failed. "Failed to open a connection ...."

JOSM fails to upload changes with message:
josm fails

Failed to open a connection to the remote server ‘https://api.openstreetmap.org/api/0.6/’.
Please check your internet connection.

  • I deinstalled JOSM, downloaded Windows MSI and now use version 19253
  • sometimes it works. But I tried now for 20 times with no success.
  • Win11 Home 23H2
  • it sometimes also happens during data download
  • I use OAuth 2.0

OSM server settings in “preferences”:
settings Oauth2

Button “Test access” token under Preferences also sometimes fails.

ping api.openstreetmap.org /t works continuously.

What is the problem? Is the osm server just too busy? Is my edit to big (uploading 184 objects)?

Begin of JOSM status report:

{{{
Revision:19253
Build-Date:2024-10-31 17:41:55

Identification: JOSM/1.5 (19253 en_GB) Windows 11 64-Bit
OS Build number: Windows 10 Home 23H2 (22631)
Memory Usage: 456 MB / 10664 MB (147 MB allocated, but free)
Java version: 21.0.5+11-LTS, Azul Systems, Inc., OpenJDK 64-Bit Server VM
Look and Feel: com.sun.java.swing.plaf.windows.WindowsLookAndFeel
Screen: \Display0 1920x1080x32bpp@60Hz (scaling 1.00×1.00)
Maximum Screen Size: 1920×1080
Best cursor sizes: 16×16→32×32, 32×32→32×32
System property file.encoding: UTF-8
System property sun.jnu.encoding: Cp1252
Locale info: en_GB
Numbers with default locale: 1234567890 -> 1234567890
VM arguments: [-Djpackage.app-version=1.5.19253, -XX:MaxRAMPercentage=75.0, --add-modules=java.scripting,java.sql,javafx.controls,javafx.media,javafx.swing,javafx.web, --add-exports=java.base/sun.security.action=ALL-UNNAMED, --add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED, --add-exports=java.desktop/com.sun.imageio.spi=ALL-UNNAMED, --add-opens=java.base/java.lang=ALL-UNNAMED, --add-opens=java.base/java.nio=ALL-UNNAMED, --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED, --add-opens=java.base/jdk.internal.ref=ALL-UNNAMED, --add-opens=java.desktop/javax.imageio.spi=ALL-UNNAMED, --add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED, --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED, -Djpackage.app-path=%UserProfile%\AppData\Local\JOSM\JOSM.exe]
Dataset consistency test: No problems found

Last errors/warnings:
- 02079.972 W: java.net.SocketException: Connection reset
- 02079.972 W: Already here java.net.SocketException: Connection reset
- 02079.972 E: org.openstreetmap.josm.io.OsmTransferException: java.net.SocketException: Connection reset. Cause: java.net.SocketException: Connection reset
- 02079.975 E: Test failed - <html>Failed to retrieve information about the current user from the OSM server 'https://api.openstreetmap.org/api'.<br>This is probably not a problem caused by the tested Access Token, but<br>rather a problem with the server configuration. Carefully check the server<br>URL and your Internet connection.</html>
- 02095.063 W: java.net.SocketException: Connection reset
- 02095.063 W: Already here java.net.SocketException: Connection reset
- 02095.063 E: org.openstreetmap.josm.io.OsmTransferException: java.net.SocketException: Connection reset. Cause: java.net.SocketException: Connection reset
- 02095.067 E: Test failed - <html>Failed to retrieve information about the current user from the OSM server 'https://api.openstreetmap.org/api'.<br>This is probably not a problem caused by the tested Access Token, but<br>rather a problem with the server configuration. Carefully check the server<br>URL and your Internet connection.</html>
- 02281.158 E: org.openstreetmap.josm.io.OsmTransferException: java.net.SocketException: Connection reset. Cause: java.net.SocketException: Connection reset
- 02281.161 E: Network exception - <html>Failed to open a connection to the remote server<br>'https://api.openstreetmap.org/api/0.6/'.<br>Please check your internet connection.</html>

The problem is probably due to your Internet connection, the operating system or Java.

Unlikely.

No.

Maybe this has something to do with IPv4 / IPv6.

ping should be IPv4. Does it always work, only sometimes or not at all with IPv6?
ping -6 api.openstreetmap.org

It may help to prefer IPv4 in JOSM:
-Djava.net.preferIPv4Stack=true

But that’s a guess.

1 Like

Tried the upload now after some hours and it works with first try. (I had saved my edits as .joz file).

Pings with -4 und -6 work continuously

When starting JOSM, this error pops up immediately:
java error

“Latest warnings” in JOSM status report:

Last errors/warnings:
- 00000.310 W: extended font config - overriding 'filename.Myanmar_Text=mmrtext.ttf' with 'MMRTEXT.TTF'
- 00000.310 W: extended font config - overriding 'filename.Mongolian_Baiti=monbaiti.ttf' with 'MONBAITI.TTF'
- 00000.615 E: java.security.KeyStoreException: Windows-ROOT not found. Cause: java.security.NoSuchAlgorithmException: Windows-ROOT KeyStore not available
- 00002.371 W: java.net.SocketException: Connection reset
- 00002.372 E: java.net.SocketException: Connection reset
- 00002.372 E: org.openstreetmap.josm.io.OsmTransferException: Could not connect to the OSM server. Please check your internet connection.. Cause: java.net.SocketException: Connection reset
- 00006.537 W: java.net.SocketException: Connection reset
- 00006.537 W: Already here java.net.SocketException: Connection reset
- 00006.537 E: java.net.SocketException: Connection reset
- 00006.538 W: org.openstreetmap.josm.io.OsmTransferException: Could not connect to the OSM server. Please check your internet connection.. Cause: java.net.SocketException: Connection reset

I tried this Djava.net … and it seems to help

set JAVA_TOOL_OPTIONS=-Djava.net.preferIPv4Stack=true
JOSM

→ No error.
I checked the status report. The key is listed as

VM arguments: [-Djava.net.preferIPv4Stack=true, -Djpackage.app-ve .....

I did a doublecheck afterwards, doing

set JAVA_TOOL_OPTIONS=""
JOSM

This also works often, but sometimes the startup error (see above) appears. The error condition is unstable, as mentioned earlier.

This really seems to solve my problem. Thank you!!

2 Likes