{"record":{"id":"d1fe1069fb7920db","repo":"zhisheng17/flink-learning","slug":"unknown-kubernetes-deployment-target-deployment","errorCode":null,"errorMessage":"Unknown Kubernetes deployment target \"${deploymentTargetStr}\". The available options are: ${options()}","messagePattern":"Unknown Kubernetes deployment target \"(.+?)\"\\. The available options are: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-learning-k8s/flink-k8s/src/main/java/org/apache/flink/kubernetes/configuration/KubernetesDeploymentTarget.java","lineNumber":52,"sourceCode":"public enum KubernetesDeploymentTarget {\n\n\tSESSION(\"kubernetes-session\"),\n\tAPPLICATION(\"kubernetes-application\");\n\n\tprivate final String name;\n\n\tKubernetesDeploymentTarget(final String name) {\n\t\tthis.name = checkNotNull(name);\n\t}\n\n\tpublic static KubernetesDeploymentTarget fromConfig(final Configuration configuration) {\n\t\tcheckNotNull(configuration);\n\n\t\tfinal String deploymentTargetStr = configuration.get(DeploymentOptions.TARGET);\n\t\tfinal KubernetesDeploymentTarget deploymentTarget = getFromName(deploymentTargetStr);\n\n\t\tif (deploymentTarget == null) {\n\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\"Unknown Kubernetes deployment target \\\"\" + deploymentTargetStr + \"\\\".\" +\n\t\t\t\t\t\t\t\" The available options are: \" + options());\n\t\t}\n\t\treturn deploymentTarget;\n\t}\n\n\tpublic String getName() {\n\t\treturn name;\n\t}\n\n\tpublic static boolean isValidKubernetesTarget(final String configValue) {\n\t\treturn configValue != null &&\n\t\t\t\tArrays.stream(KubernetesDeploymentTarget.values())\n\t\t\t\t\t\t.anyMatch(kubernetesDeploymentTarget -> kubernetesDeploymentTarget.name.equalsIgnoreCase(configValue));\n\t}\n\n\tprivate static KubernetesDeploymentTarget getFromName(final String deploymentTarget) {\n\t\tif (deploymentTarget == null) {","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/zhisheng17/flink-learning/blob/d731cee7618021be56d132cc925102ffff8d75e6/flink-learning-k8s/flink-k8s/src/main/java/org/apache/flink/kubernetes/configuration/KubernetesDeploymentTarget.java#L34-L70","documentation":"KubernetesDeploymentTarget.fromConfig validates DeploymentOptions.TARGET against the known Kubernetes targets (kubernetes-session, kubernetes-application, case-insensitive). If the configured value is null or unrecognized, an IllegalArgumentException listing the valid options is thrown.","triggerScenarios":"Reading deployment.target from the Flink configuration during Kubernetes deployment when it is unset (null) or set to anything other than 'kubernetes-session'/'kubernetes-application'.","commonSituations":"Typo like 'kubernetes-app' or 'k8s-application'; forgetting -t on the flink command line; leftover target 'local'/'remote'/'yarn' in a config reused for Kubernetes; case-sensitive tooling that lowercased the value differently (matching is case-insensitive, so usually a real misspelling).","solutions":["Set target to kubernetes-application: flink run-application -t kubernetes-application ... (or kubernetes-session for session mode).","Fix typos in deployment.target in flink-conf.yaml or the command line; only the two listed values are valid.","If programmatically building the config, call configuration.set(DeploymentOptions.TARGET, ...) before deployment, or pre-validate with KubernetesDeploymentTarget.isValidKubernetesTarget(value)."],"exampleFix":"// before\nconfig.set(DeploymentOptions.TARGET, \"kubernetes-app\");\n// after\nconfig.set(DeploymentOptions.TARGET, \"kubernetes-application\");","handlingStrategy":"validation","validationCode":"String target = config.get(DeploymentOptions.TARGET);\nif (!KubernetesDeploymentTarget.isValidKubernetesTarget(target)) {\n    throw new IllegalArgumentException(\"Invalid deployment.target: \" + target + \" (use kubernetes-session|kubernetes-application)\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    descriptor.deployApplicationCluster(spec, appConfig);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Unknown Kubernetes deployment target\")) {\n        config.set(DeploymentOptions.TARGET, \"kubernetes-application\");\n    }\n}","preventionTips":["Always pass -t kubernetes-application or kubernetes-session","Validate targets with isValidKubernetesTarget before deploy","Grep flink-conf.yaml for stale local/yarn/remote targets","Watch for typos like kubernetes-app"],"tags":["kubernetes","flink","deployment-target","invalid-config"],"backgroundTag":"invalid-enum-value","analyzedSha":"d731cee7618021be56d132cc925102ffff8d75e6","analyzedAt":"2026-09-06T05:35:08.496Z","contentChangedAt":"2026-09-06T05:35:08.496Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}