{"record":{"id":"19fdaf6f220a7dd4","repo":"quarkusio/quarkus","slug":"openshift-miscellaneous-api-is-not-available-plea","errorCode":null,"errorMessage":"OpenShift Miscellaneous API is not available, please add the openshift-model-miscellaneous module to your classpath","messagePattern":"OpenShift Miscellaneous API is not available, please add the openshift-model-miscellaneous module to your classpath","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"extensions/openshift-client/runtime/src/main/java/io/quarkus/it/openshift/client/runtime/graal/MiscellaneousSubstitutions.java","lineNumber":37,"sourceCode":"import io.fabric8.openshift.api.model.miscellaneous.helm.v1beta1.HelmChartRepositoryList;\nimport io.fabric8.openshift.api.model.miscellaneous.helm.v1beta1.ProjectHelmChartRepository;\nimport io.fabric8.openshift.api.model.miscellaneous.helm.v1beta1.ProjectHelmChartRepositoryList;\nimport io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.BareMetalHost;\nimport io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.BareMetalHostList;\nimport io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3Remediation;\nimport io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3RemediationList;\nimport io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3RemediationTemplate;\nimport io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3RemediationTemplateList;\n\n/**\n * Allows the exclusion of the openshift-model-miscellaneous model without breaking the --link-at-build-time check.\n */\n@TargetClass(className = \"io.fabric8.openshift.client.impl.OpenShiftClientImpl\", onlyWith = MiscellaneousSubstitutions.NoOpenShiftMiscellaneousModel.class)\npublic final class MiscellaneousSubstitutions {\n\n    @Substitute\n    public NonNamespaceOperation<APIRequestCount, APIRequestCountList, Resource<APIRequestCount>> apiRequestCounts() {\n        throw new RuntimeException(Constants.ERROR_MESSAGE);\n    }\n\n    @Substitute\n    public MixedOperation<BareMetalHost, BareMetalHostList, Resource<BareMetalHost>> bareMetalHosts() {\n        throw new RuntimeException(Constants.ERROR_MESSAGE);\n    }\n\n    @Substitute\n    public MixedOperation<CredentialsRequest, CredentialsRequestList, Resource<CredentialsRequest>> credentialsRequests() {\n        throw new RuntimeException(Constants.ERROR_MESSAGE);\n    }\n\n    @Substitute\n    public NonNamespaceOperation<HelmChartRepository, HelmChartRepositoryList, Resource<HelmChartRepository>> helmChartRepositories() {\n        throw new RuntimeException(Constants.ERROR_MESSAGE);\n    }\n\n    @Substitute","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/openshift-client/runtime/src/main/java/io/quarkus/it/openshift/client/runtime/graal/MiscellaneousSubstitutions.java#L19-L55","documentation":"This is a GraalVM native-image substitution on OpenShiftClientImpl.apiRequestCounts. When the fabric8 openshift-model-miscellaneous module is absent from the classpath, the substitution replaces the real method so that any native-image call throws a RuntimeException telling you the OpenShift Miscellaneous API is unavailable. It exists so failures happen with a clear message instead of an unresolved-class error in native executables.","triggerScenarios":"Calling OpenShiftClient.apiRequestCounts() from code running in a native image where the quarkus-openshift-client extension detected (NoOpenShiftMiscellaneousModel condition) that openshift-model-miscellaneous is not on the classpath.","commonSituations":"Applications listing/watching APIRequestCount resources on OpenShift 4.x; projects built with a trimmed fabric8 dependency set; upgrading Quarkus/fabric8 and the model module was removed as 'unused' by dependency cleanup.","solutions":["Add io.fabric8:openshift-model-miscellaneous to your dependencies (the quarkus-openshift-client extension pulls it transitively if you need it)","If you don't need Miscellaneous API resources, guard/remove the apiRequestCounts() calls when running in native mode","Rebuild the native image after adding the module so the substitution no longer applies"],"exampleFix":"// before (pom.xml)\n<dependency><groupId>io.quarkus</groupId><artifactId>quarkus-openshift-client</artifactId></dependency>\n// after\n<dependency><groupId>io.quarkus</groupId><artifactId>quarkus-openshift-client</artifactId></dependency>\n<dependency><groupId>io.fabric8</groupId><artifactId>openshift-model-miscellaneous</artifactId></dependency>","handlingStrategy":"fallback","validationCode":"boolean miscModelAvailable;\ntry {\n    Class.forName(\"io.fabric8.openshift.api.model.miscellaneous.APIRequestCount\", false,\n        Thread.currentThread().getContextClassLoader());\n    miscModelAvailable = true;\n} catch (ClassNotFoundException e) {\n    miscModelAvailable = false;\n}","typeGuard":"static boolean supportsMiscellaneousApi(OpenShiftClient client) {\n    try {\n        Class.forName(\"io.fabric8.openshift.api.model.miscellaneous.apiserver.APIRequestCount\", false,\n            OpenShiftClient.class.getClassLoader());\n        return true;\n    } catch (ClassNotFoundException e) {\n        return false;\n    }\n}","tryCatchPattern":"try {\n    client.apiRequestCounts().list();\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"openshift-model-miscellaneous\")) {\n        log.warn(\"Miscellaneous API model missing; skipping APIRequestCount operations\");\n        return List.of();\n    }\n    throw e;\n}","preventionTips":["Always declare io.fabric8:openshift-model-miscellaneous explicitly if you touch Miscellaneous API resources","Smoke-test native builds for every client method used, since substitutions only fail at native runtime","Never 'clean up' fabric8 model dependencies without checking which OpenShiftClient accessors the code calls"],"tags":["kubernetes","openshift","native-image","fabric8","classpath"],"backgroundTag":"missing-model-module-native","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}