{"record":{"id":"cfe57327df615bde","repo":"OpenAPITools/openapi-generator","slug":"description-not-found-in-the-available-values","errorCode":null,"errorMessage":"description not found in the available values.","messagePattern":"description not found in the available values\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator-core/src/main/java/org/openapitools/codegen/meta/Stability.java","lineNumber":63,"sourceCode":"    }\n\n    /**\n     * Returns a value for this stability index.\n     *\n     * @return The descriptive value of this enum.\n     */\n    public String value() {\n        return description;\n    }\n\n    public static Stability forDescription(String description) {\n        for (Stability value : values()) {\n            if (value.description.equals(description)) {\n                return value;\n            }\n        }\n\n        throw new IllegalArgumentException(\"description not found in the available values.\");\n    }\n}\n","sourceCodeStart":45,"sourceCodeEnd":66,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/meta/Stability.java#L45-L66","documentation":"Thrown by Stability.forDescription(String) in openapi-generator-core when the argument does not exactly equal (case-sensitive, no trimming) one of the lowercase descriptions of the Stability enum: \"stable\", \"beta\", \"experimental\", \"deprecated\". The method is the reverse lookup for the node.js-style stability index attached to generators and features, so any consumer mapping an external string back to the enum hits this when the string is unknown. It is a plain IllegalArgumentException with no echo of the offending input, which makes the cause easy to miss.","triggerScenarios":"Calling Stability.forDescription(\"Stable\"), forDescription(\"STABLE\"), forDescription(\" experimental\") (leading/trailing whitespace), or any string not in the set. Passing null also ends here because equals never matches, and the loop falls through to the throw. Typical call sites read the stability string from generator metadata, JSON/YAML config, or user-supplied filter options (e.g. Generators API filtering by stability).","commonSituations":"Tooling built on openapi-generator that lets users type a stability filter; upgrading openapi-generator versions where a new stability level (e.g. \"deprecated\" added later) is written by a newer version but read by an older one; locale-specific casing (\"Stable\" in en-US UIs); parsing the stability value out of a markdown/docs table that capitalizes it.","solutions":["Pass one of the exact lowercase strings: \"stable\", \"beta\", \"experimental\", or \"deprecated\" (the check is case-sensitive and does not trim whitespace).","Normalize before calling: description == null ? null : Stability.forDescription(description.trim().toLowerCase(Locale.ROOT)).","If you cannot trust the input, guard with Arrays.stream(Stability.values()).noneMatch(v -> v.value().equals(desc)) and fall back to a default or reject with your own error naming the bad value.","On mismatch, include the offending value and the valid set in your own error message; the stock message does not echo the input."],"exampleFix":"// before\nStability s = Stability.forDescription(userInput); // \"Stable\" -> IllegalArgumentException\n\n// after\nStability s = Arrays.stream(Stability.values())\n        .filter(v -> v.value().equals(userInput == null ? null : userInput.trim().toLowerCase(Locale.ROOT)))\n        .findFirst()\n        .orElseThrow(() -> new IllegalArgumentException(\n                \"Unknown stability '\" + userInput + \"'. Valid: stable, beta, experimental, deprecated\"));","handlingStrategy":"validation","validationCode":"boolean known = description != null && Arrays.stream(Stability.values())\n        .anyMatch(v -> v.value().equals(description.trim().toLowerCase(Locale.ROOT)));\nif (!known) {\n    throw new IllegalArgumentException(\"Unknown stability '\" + description\n            + \"'. Valid values: stable, beta, experimental, deprecated\");\n}","typeGuard":"// Java 'type guard' for the stability description vocabulary\npublic static boolean isStabilityDescription(String s) {\n    if (s == null) return false;\n    String norm = s.trim().toLowerCase(Locale.ROOT);\n    return norm.equals(\"stable\") || norm.equals(\"beta\")\n            || norm.equals(\"experimental\") || norm.equals(\"deprecated\");\n}","tryCatchPattern":"try {\n    Stability s = Stability.forDescription(raw);\n} catch (IllegalArgumentException e) {\n    // message does not echo the input; log raw and the valid set yourself\n    LOG.warn(\"Ignoring unknown stability '{}' (valid: stable, beta, experimental, deprecated)\", raw);\n    Stability s = Stability.STABLE; // explicit fallback decision\n}","preventionTips":["Treat the stability vocabulary as a fixed enum contract: stable, beta, experimental, deprecated — all lowercase.","Normalize user input (trim + lowercase Locale.ROOT) before calling forDescription.","Never pass raw external strings (config, JSON, CLI args) directly into the reverse lookup.","When adding a new stability level across versions, keep writers and readers on the same openapi-generator version."],"tags":["openapi-generator","java","enum-lookup","illegal-argument","case-sensitivity"],"backgroundTag":"invalid-enum-value","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}