502 Bad Gateway error when an Amster (All versions) command fails

Last updated Jul 9, 2018

The purpose of this article is to provide assistance if an Amster command fails and you see an "ERROR org.forgerock.openam.sdk.http.DefaultErrorHandler - Unhandled server error: [Status: 502 Bad Gateway]".


The following response is shown when an Amster command fails:

[main] ERROR org.forgerock.openam.sdk.http.DefaultErrorHandler - Unhandled server error: [Status: 502 Bad Gateway]
ERROR org.forgerock.openam.sdk.http.ServerErrorException:
502 Bad Gateway
   at org.forgerock.openam.sdk.http.DefaultErrorHandler.onServerError (
   at org.forgerock.openam.sdk.http.HttpSessionImpl.handleUnsuccessfulResponse (
   at org.forgerock.openam.sdk.http.HttpSessionImpl.send (
   at (
   at org.forgerock.openam.sdk.crest.CrestResourceProviderAsync.actionCollection (
   at org.forgerock.openam.sdk.crest.HttpCrestResourceProvider.actionCollection (
   at org.forgerock.openam.sdk.operations.CrestOperations.action (
   at org.forgerock.openam.sdk.operations.CrestOperations.action (
   at org.forgerock.openam.amster.loadster.EntityTypeProvider.getCustomSubEntityTypes (EntityTypeProvider.groovy:168)
   at org.forgerock.openam.amster.loadster.EntityTypeProvider.getCustomEntityTypes (EntityTypeProvider.groovy:157)
   at org.forgerock.openam.amster.loadster.EntityTypeProvider.getEntityTypes (EntityTypeProvider.groovy:102)
   at org.forgerock.openam.amster.loadster.EntityTypeProvider.getGlobalEntityTypes (EntityTypeProvider.groovy:84)
   at org.forgerock.openam.amster.loadster.importer.Importer.<init> (Importer.groovy:72)
   at org.forgerock.openam.amster.commands.ImportCommand.execute (ImportCommand.groovy:52)
   at org.forgerock.openam.amster.Main$_addCommandLineWrapping_closure2.doCall (Main.groovy:90)
   at java_lang_Runnable$ (Unknown Source)
   at org.forgerock.openam.amster.Main.main (Main.groovy:60)

Recent Changes



A REST call to the AM server is not serviced within the 10 second read-timeout. This is a hard-coded timeout that is not configurable since 10 seconds is sufficient in a working environment; this error usually indicates an unresponsive AM server.


This issue can be resolved by addressing the reason(s) why the AM server is unresponsive. If the unresponsiveness is associated with high CPU, see How do I troubleshoot high CPU utilization on AM/OpenAM (All versions) servers? for further information.

Other possible reasons include network and storage bottlenecks on the AM server, which you should investigate and resolve as needed.

See Also

FAQ: Installing and using Amster in AM

How do I enable debug mode for troubleshooting Amster (All versions)?

How do I diagnose a hung AM/OpenAM (All versions) server?

How do I use the msnapshots script to capture information for troubleshooting AM/OpenAM (All versions)?

Troubleshooting AM/OpenAM and Policy Agents

Using Amster in AM

User Guide

Related Training


Related Issue Tracker IDs

OPENAM-11876 (Amster has a timeout limit of 10 second and it is not configurable )

OPENAM-11773 (amster throws missleading error '502 bad gateway')

Copyright and TrademarksCopyright © 2018 ForgeRock, all rights reserved.