{"record":{"id":"4943446354b6f63f","repo":"apache/druid","slug":"task-s-requested-pod-template-s-via-context","errorCode":null,"errorMessage":"Task [%s] requested pod template [%s] via context key, but no such template is configured.","messagePattern":"Task \\[(.+?)\\] requested pod template \\[(.+?)\\] via context key, but no such template is configured\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/taskadapter/DynamicConfigPodTemplateSelector.java","lineNumber":133,"sourceCode":"      throw new IAE(e, \"Failed to load pod template file for [%s] at [%s]\", property, podTemplateFile);\n    }\n  }\n\n  @SuppressWarnings(\"ResultOfMethodCallIgnored\")\n  private void validateTemplateSupplier(Supplier<PodTemplate> templateSupplier) throws IAE\n  {\n    templateSupplier.get();\n  }\n\n  @Override\n  public Optional<PodTemplateWithName> getPodTemplateForTask(Task task)\n  {\n    String requested = task.getContextValue(DruidK8sConstants.TASK_CONTEXT_POD_TEMPLATE_SELECTION_KEY);\n\n    if (requested != null && effectiveConfig.isAllowTaskPodTemplateSelection()) {\n      Supplier<PodTemplate> supplier = podTemplates.get(requested);\n      if (supplier == null) {\n        throw new IAE(\n            \"Task [%s] requested pod template [%s] via context key, but no such template is configured.\",\n            task.getId(), requested\n        );\n      }\n      log.debug(\"Pod template [%s] selected for task [%s] via context override.\", requested, task.getId());\n      return Optional.of(new PodTemplateWithName(requested, supplier.get()));\n    } else if (requested != null) {\n      log.warn(\n          \"Task [%s] set context key [%s] but pod template override is disabled; ignoring.\",\n          task.getId(),\n          DruidK8sConstants.TASK_CONTEXT_POD_TEMPLATE_SELECTION_KEY\n      );\n    }\n\n    return Optional.of(effectiveConfig.getPodTemplateSelectStrategy().getPodTemplateForTask(task, podTemplates));\n  }\n\n  @Override","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/taskadapter/DynamicConfigPodTemplateSelector.java#L115-L151","documentation":"Thrown by DynamicConfigPodTemplateSelector.getPodTemplateForTask when a task sets the pod-template context key (DruidK8sConstants.TASK_CONTEXT_POD_TEMPLATE_SELECTION_KEY) to a template name that is not registered in the selector's podTemplates map, and task-side pod template selection is enabled via effectiveConfig.isAllowTaskPodTemplateSelection(). Druid rejects the task launch rather than silently falling back to the base template.","triggerScenarios":"A task's context contains e.g. {\"k8sPodTemplateSelection\": \"myTemplate\"} (context key value) while no druid.indexer.runner.k8s.podTemplate.myTemplate property is configured on the Overlord, and druid.indexer.runner.k8s.allowTaskPodTemplateSelection=true.","commonSituations":"Ingestion specs copied from examples referencing template names defined in another cluster; template renamed/removed on the Overlord while old task specs still reference it; allowTaskPodTemplateSelection enabled but the operator forgot to define every template tasks reference; typo in the context value.","solutions":["Define the missing template on the Overlord: druid.indexer.runner.k8s.podTemplate.<requested-name>=/path/to/template.yaml","Correct the context value in the task/ingestion spec to match a configured template name exactly","Verify template names are deployed to all Overlords the task may be routed to","If context-driven selection is undesired, disable druid.indexer.runner.k8s.allowTaskPodTemplateSelection"],"exampleFix":"// before (task context)\n\"context\": { \"k8sPodTemplateSelection\": \"batchHeavy\" }  // template not configured\n\n// after (Overlord config)\ndruid.indexer.runner.k8s.podTemplate.batchHeavy=/etc/druid/k8s/batch-heavy.yaml\n# task context stays as-is, template now exists","handlingStrategy":"validation","validationCode":"// Before submitting a task with a pod template context override\nString requested = task.getContextValue(\"k8sPodTemplateSelection\");\nif (requested != null) {\n    String prop = \"druid.indexer.runner.k8s.podTemplate.\" + requested;\n    if (overlordProps.getProperty(prop) == null) {\n        throw new IllegalArgumentException(\n            \"Pod template '\" + requested + \"' not configured on Overlord (missing \" + prop + \")\");\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    PodTemplate t = selector.getPodTemplateForTask(task, effectiveConfig);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"no such template is configured\")) {\n        // log and fall back to default selection instead of failing the task\n        return defaultPodTemplate;\n    }\n    throw e;\n}","preventionTips":["Keep a registry of allowed template names shared between spec authors and Overlord config","When renaming/removing templates, grep ingestion specs for the old context values","Only enable allowTaskPodTemplateSelection after all referenced templates are deployed to every Overlord"],"tags":["kubernetes","pod-template","task-context","druid-overlord"],"backgroundTag":"resource-not-found","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}