quarkusio/quarkus · error · RuntimeException

<type> '<name>' not found (plus namespace hint or ' in names

Error message

<type> '<name>' not found (plus namespace hint or ' in namespace <namespace>')

What it means

logMissingOrFail builds a message '<type> <name> not found' with a namespace hint, and when quarkus.kubernetes-config.fail-on-missing-config is true it throws a RuntimeException naming the missing ConfigMap or Secret. It is thrown deliberately for a resource the user asked for that simply does not exist in the looked-up namespace. When fail-on-missing is false it only logs at info level.

Source

Thrown at extensions/kubernetes-config/runtime/src/main/java/io/quarkus/kubernetes/config/runtime/KubernetesConfigSourceFactory.java:174

            }
            return result;
        } catch (Exception e) {
            throw new RuntimeException("Unable to obtain configuration for Secret objects from Kubernetes API Server at: "
                    + client.getConfiguration().getMasterUrl(), e);
        }
    }

    private void logMissingOrFail(String name, String namespace, String type, boolean failOnMissingConfig) {
        String message = type + " '" + name + "' not found";
        if (namespace == null) {
            message = message
                    + ". No Kubernetes namespace was set (most likely because the application is running outside the Kubernetes cluster). Consider setting 'quarkus.kubernetes-client.namespace=my-namespace' to specify the namespace in which to look up the "
                    + type;
        } else {
            message = message + " in namespace '" + namespace + "'";
        }
        if (failOnMissingConfig) {
            throw new RuntimeException(message);
        } else {
            log.info(message);
        }
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Create the missing ConfigMap/Secret in the namespace indicated in the message (kubectl apply / kubectl create).
  2. Check quarkus.kubernetes-config.namespaces for typos and ensure the resource exists there.
  3. Set quarkus.kubernetes-client.namespace explicitly when running outside the cluster.
  4. If absence is acceptable, set quarkus.kubernetes-config.fail-on-missing-config=false to downgrade to a log message.
  5. Verify the name matches exactly (names are case-sensitive, no stray whitespace).

Example fix

// before: name/namespace mismatch
quarkus.kubernetes-config.config-maps=app-cfg
// after: resource exists in 'prod' namespace
quarkus.kubernetes-config.config-maps=app-cfg
quarkus.kubernetes-config.namespaces=prod
# or tolerate absence:
# quarkus.kubernetes-config.fail-on-missing-config=false
Defensive patterns

Strategy: validation

Validate before calling

// Verify every configured resource exists before startup:
String ns = "my-namespace";
for (String cm : List.of("app-cfg")) {
    if (client.configMaps().inNamespace(ns).withName(cm).get() == null) {
        throw new IllegalStateException("Missing ConfigMap " + cm + " in " + ns);
    }
}

Try / catch

try {
    app.start();
} catch (RuntimeException e) {
    if (e.getMessage().contains("not found")) {
        log.error("Config resource missing: {}", e.getMessage()); // includes name + namespace hint
    }
}

Prevention

When it happens

Trigger: A name listed in quarkus.kubernetes-config.config-maps or quarkus.kubernetes-config.secrets (or via programmatic registration) is not found in the namespace — either the object does not exist, the namespace is wrong, or (outside a cluster) no namespace is set so the lookup targets nothing.

Common situations: Typo in ConfigMap/Secret name; resource created in a different namespace than quarkus.kubernetes-config.namespaces; app running locally/outside cluster with no quarkus.kubernetes-client.namespace, so the default namespace is empty; resource deleted after deployment.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/513f236111595c47. Report an issue: GitHub.