OpenAPITools/openapi-generator · warning · ResponseStatusException

Unsupported target %s supplied. %s

Error message

Unsupported target %s supplied. %s

What it means

Thrown by GET /api/gen/clients/{language}/options and GET /api/gen/servers/{framework}/options (via Generator.getOptions, Generator.java:39-46) when CodegenConfigLoader.forName(language) throws while loading the generator. This is a 404 whose message embeds the loader's exception, so it covers two distinct causes: the name simply is not a registered generator, or a discoverable generator class failed to load (NoClassDefFoundError/missing dependency in a custom deployment). Note it catches Exception, not just RuntimeException, so linkage errors surface here too.

Source

Thrown at modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/Generator.java:44

import org.openapitools.codegen.online.model.GeneratorInput;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.web.server.ResponseStatusException;

import java.io.File;
import java.nio.file.Files;
import java.util.*;

public class Generator {
    private static Logger LOGGER = LoggerFactory.getLogger(Generator.class);

    public static Map<String, CliOption> getOptions(String language) {
        CodegenConfig config;
        try {
            config = CodegenConfigLoader.forName(language);
        } catch (Exception e) {
            throw new ResponseStatusException(HttpStatus.NOT_FOUND, String.format(Locale.ROOT, "Unsupported target %s supplied. %s",
                    language, e));
        }
        Map<String, CliOption> map = new LinkedHashMap<>();
        for (CliOption option : config.cliOptions()) {
            map.put(option.getOpt(), option);
        }
        return map;
    }

    public enum Type {
        CLIENT("client"), SERVER("server");

        private String name;

        Type(String name) {
            this.name = name;
        }

View on GitHub (pinned to fcec517be3)

Solutions

  1. GET /api/gen/clients (and /api/gen/servers) first and use a name exactly as listed, case-sensitive
  2. Match the generator list to your server's openapi-generator version — check the release notes for renamed/removed generators
  3. For custom generators, verify the jar is on the classpath and registered via META-INF/services/org.openapitools.codegen.CodegenConfig
  4. Read the embedded cause after 'Unsupported target ... supplied.' — a loader/linkage error means classpath, not a typo

Example fix

# before
curl -s "$host/api/gen/clients/jav/options"   # 404 Unsupported target jav supplied. ...

# after
curl -s "$host/api/gen/clients" | jq -e 'index("java")' >/dev/null || { echo "bad generator name" >&2; exit 1; }
curl -s "$host/api/gen/clients/java/options"
Defensive patterns

Strategy: validation

Validate before calling

// fetch the authoritative list and check membership before the options call
List<String> clients = restTemplate.getForObject(host + "/api/gen/clients", List.class);
if (!clients.contains(language)) {
    throw new IllegalArgumentException("unsupported generator '" + language + "'; valid: " + clients);
}

Type guard

boolean isKnownGenerator(String name, List<String> known) {
    return name != null && known.stream().anyMatch(name::equals); // case-sensitive
}

Try / catch

catch (HttpClientErrorException.NotFound e) {
    // message embeds the loader cause: typos vs broken custom-generator classpath
    log.warn("options lookup failed: {}", e.getResponseBodyAsString());
}

Prevention

When it happens

Trigger: Asking for options of a nonexistent/mistyped generator ('jav', 'python2' on newer versions, renamed/removed generators like 'lumen' or old 'swift'); case mismatch ('Java' vs 'java'); a custom generator registered in META-INF/services but whose classpath is broken; asking /clients/... options for a server-only generator name.

Common situations: Hardcoding generator names across openapi-generator versions (generators get renamed/removed between releases); calling the public api.openapi-generator.cloud with a name from an older release; self-hosted images that forgot to bundle custom generator jars.

Related errors


AI-assisted analysis of OpenAPITools/openapi-generator@fcec517be3 (2026-08-22). Data as JSON: /api/errors/accaf0e2001869c6. Report an issue: GitHub.