{"record":{"id":"62c0dbcc0d6a636a","repo":"OpenAPITools/openapi-generator","slug":"unable-to-locate-java-helidon-common-status-java","errorCode":null,"errorMessage":"Unable to locate /java-helidon/common/Status.java to discover known HTTP statuses","messagePattern":"Unable to locate /java-helidon/common/Status\\.java to discover known HTTP statuses","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaHelidonCommonCodegen.java","lineNumber":489,"sourceCode":"    /**\n     * Prepares a map of predefined HTTP status code constants.\n     * <p>\n     * Helidon uses its own HTTP status type, and the Helidon code predefines many HTTP status code constants but also allows\n     * ad hoc creation of other values based on the numeric status value. It's more efficient at runtime to use a constant\n     * if it exists.\n     * <p>\n     * This method scans a copy of the Helidon Java file which contains the predefined constants and prepares a map\n     * from the string representation of the numeric code to the Helidon constant name. This table allows us, when we are\n     * generating the Response records for an operation, to use the Helidon predefined constant--if it exists--for the\n     * response code declared for an operation in the OpenAPI document.\n     * </p>\n     *\n     * @return prepared map\n     */\n    private HashMap<String, String> loadKnownHttpStatusMap() {\n        try (InputStream is = getClass().getResourceAsStream(\"/java-helidon/common/Status.java\")) {\n            if (is == null) {\n                throw new RuntimeException(\"Unable to locate /java-helidon/common/Status.java to discover known HTTP statuses\");\n            }\n            Pattern statusPattern = Pattern.compile(\"public static final Status (\\\\w+)\\\\s*=\\\\s*new\\\\s*Status\\\\((\\\\d+)\",\n                    Pattern.MULTILINE);\n            return new Scanner(is, StandardCharsets.UTF_8)\n                    .findAll(statusPattern)\n                    .collect(HashMap::new,\n                            (map, match) -> map.put(match.group(2), match.group(1)),\n                            Map::putAll);\n\n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    private void setHelidonVersion(String version) {\n        helidonVersion = VersionUtil.instance().chooseVersionBestMatchOrSelf(version);\n        setParentVersion(helidonVersion);\n        helidonMajorVersion = VersionUtil.majorVersion(helidonVersion);","sourceCodeStart":471,"sourceCodeEnd":507,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaHelidonCommonCodegen.java#L471-L507","documentation":"Thrown by JavaHelidonCommonCodegen.loadKnownHttpStatusMap when the classpath resource /java-helidon/common/Status.java cannot be opened. The generator carries a copy of Helidon's Status.java inside its own JAR and regex-scans it to map numeric HTTP codes to Helidon constants (e.g. 404 -> NOT_FOUND) when building response records. A null InputStream means the generator JAR is broken or assembled without its template resources — it is an environment/packaging defect, not a user option error.","triggerScenarios":"Running a custom/shaded openapi-generator JAR where resource merging excluded src/main/resources/java-helidon/** (aggressive shade or jarjar configs). Running from an IDE where the openapi-generator module's resources directory was excluded from the build path. Using a snapshotted/embedded generator pulled in as a dependency whose classifier stripped resources.","commonSituations":"Companies build a customized 'internal codegen service' by shading openapi-generator into a fat JAR and lose the non-class resources. IDE misconfiguration (marked-as-excluded resources, Gradle sourceSet tweaks) produces the same failure locally but not on CI with the official CLI.","solutions":["Reproduce with the official distribution: openapi-generator-cli from npm/Homebrew/Docker — if it works, your packaging is the problem","In a shaded JAR, add resource inclusion filters for java-helidon/** (maven-shade-plugin: keep src/main/resources transitively, do not exclude non-.class files)","In IDEs, re-import the Maven/Gradle project and make sure modules/openapi-generator/src/main/resources is on the runtime classpath","If embedding the generator, depend on the official org.openapitools:openapi-generator artifact rather than a re-packaged one"],"exampleFix":"<!-- before: maven-shade-plugin strips generator resources -->\n<plugin>\n  <groupId>org.apache.maven.plugins</groupId>\n  <artifactId>maven-shade-plugin</artifactId>\n  <configuration>\n    <filters>\n      <filter>\n        <artifact>*:*</artifact>\n        <excludes>\n          <exclude>**/*.java</exclude> <!-- also drops java-helidon/common/Status.java -->\n        </excludes>\n      </filter>\n    </filters>\n  </configuration>\n</plugin>\n\n<!-- after: only exclude bytecode we truly own, keep generator resources -->\n<filter>\n  <artifact>com.myco:codegen-wrapper</artifact>\n  <excludes>\n    <exclude>com/myco/**</exclude>\n  </excludes>\n</filter>","handlingStrategy":"try-catch","validationCode":"// Pre-flight: verify the generator JAR carries its template resources\ntry (InputStream is = JavaHelidonCommonCodegen.class.getResourceAsStream(\"/java-helidon/common/Status.java\")) {\n    if (is == null) throw new IllegalStateException(\n        \"Generator artifact is missing /java-helidon/** resources — use the official openapi-generator JAR, not a stripped/shaded rebuild\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    new DefaultGenerator().opts(input).generate();\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"java-helidon/common/Status.java\")) {\n        // environment/packaging defect, not a config error — do not retry with different options\n        throw new IllegalStateException(\"openapi-generator artifact is broken: template resources absent from classpath. Use the official distribution.\", e);\n    }\n    throw e;\n}","preventionTips":["Run generation with the official CLI (npm/Docker/Homebrew) at least once in CI to separate packaging bugs from config bugs","If you must shade the generator, add integration tests asserting getClass().getResourceAsStream(\"/java-helidon/common/Status.java\") is non-null","Pin the openapi-generator artifact by version and avoid re-packaging it into fat JARs"],"tags":["java","helidon","openapi-generator","classpath","packaging","shaded-jar","environment"],"backgroundTag":"missing-classpath-resource","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}