OpenAPITools/openapi-generator · error · IllegalArgumentException

Invalid 'library' option specified: '{library}'. Must be 'ht

Error message

Invalid 'library' option specified: '{library}'. Must be 'httpclient' or 'volley' (default)

What it means

Error "Invalid 'library' option specified: '{library}'. Must be 'httpclient' or 'volley' (default)" thrown in OpenAPITools/openapi-generator.

Source

Thrown at modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AndroidClientCodegen.java:508

        // need to put back boolean properties into additionalProperties as the values in additionalProperties are strings
        additionalProperties.put(CodegenConstants.SERIALIZABLE_MODEL, serializableModel);
        additionalProperties.put(USE_ANDROID_MAVEN_GRADLE_PLUGIN, useAndroidMavenGradlePlugin);

        //make api and model doc path available in mustache template
        additionalProperties.put("apiDocPath", apiDocPath);
        additionalProperties.put("modelDocPath", modelDocPath);

        if (StringUtils.isEmpty(getLibrary())) {
            setLibrary("volley"); // set volley as the default library
        }

        // determine which file (mustache) to add based on library
        if ("volley".equals(getLibrary())) {
            addSupportingFilesForVolley();
        } else if ("httpclient".equals(getLibrary())) {
            addSupportingFilesForHttpClient();
        } else {
            throw new IllegalArgumentException("Invalid 'library' option specified: '" + getLibrary() + "'. Must be 'httpclient' or 'volley' (default)");
        }
    }

    @Override
    public String escapeQuotationMark(String input) {
        // remove " to avoid code injection
        return input.replace("\"", "");
    }

    @Override
    public String escapeUnsafeCharacters(String input) {
        return input.replace("*/", "*_/").replace("/*", "/_*");
    }

    private void addSupportingFilesForVolley() {
        // documentation files
        modelDocTemplateFiles.put("model_doc.mustache", ".md");
        apiDocTemplateFiles.put("api_doc.mustache", ".md");

View on GitHub (pinned to fcec517be3)

Solutions

  1. Set the 'library' option to 'httpclient' or 'volley', e.g. '--library volley', or remove it to use the default 'volley'.

When it happens

Trigger: Thrown when the 'library' option for the Android client generator is set to something other than 'httpclient' or 'volley'. Set library=httpclient or library=volley (the default).

Common situations: See trigger scenarios.


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