{"record":{"id":"c18175a4bfc72241","repo":"theonedev/onedev","slug":"step-template-not-found-c18175","errorCode":null,"errorMessage":"Step template not found: ","messagePattern":"Step template not found: ","errorType":"validation","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/buildspec/step/UseTemplateStep.java","lineNumber":117,"sourceCode":"\tpublic static List<ParamSpec> getParamSpecs() {\n\t\tString templateName = (String) EditContext.get().getInputValue(PROP_TEMPLATE_NAME);\n\t\tif (templateName != null) {\n\t\t\tBuildSpec buildSpec = BuildSpec.get();\t\n\t\t\tif (buildSpec != null) {\n\t\t\t\tStepTemplate template = buildSpec.getStepTemplateMap().get(templateName);\n\t\t\t\tif (template != null)\n\t\t\t\t\treturn template.getParamSpecs();\n\t\t\t}\n\t\t}\t\t\n\t\treturn new ArrayList<>();\n\t}\n\t\n\t@Override\n\tprotected List<Action> getActions(Build build, JobExecutor jobExecutor, String jobToken, \n\t\t\t\t\t\t\t\tParamCombination paramCombination) {\n\t\tStepTemplate template = build.getSpec().getStepTemplateMap().get(templateName);\n\t\tif (template == null)\n\t\t\tthrow new ExplicitException(\"Step template not found: \" + templateName);\n\t\t\n\t\tList<Action> actions = new ArrayList<>();\n\t\tAtomicInteger repeatRef = new AtomicInteger(0);\n\t\tList<Map<String, List<String>>> paramMaps;\n\t\tvar projectScopedCommit = new ProjectScopedCommit(build.getProject(), build.getCommitId());\n\t\tProjectScopedCommit.push(projectScopedCommit);\n\t\ttry {\n\t\t\tparamMaps = resolveParams(build, paramCombination, getParamMatrix(), getExcludeParamMaps());\n\t\t} finally {\n\t\t\tProjectScopedCommit.pop();\n\t\t}\n\t\tfor (var paramMap: paramMaps) {\n\t\t\tint repeat = repeatRef.incrementAndGet();\n\t\t\tProjectScopedCommit.push(projectScopedCommit);\n\t\t\ttry {\t\n\t\t\t\tParamUtils.validateParamMap(template.getParamSpecs(), paramMap);\n\t\t\t} finally {\n\t\t\t\tProjectScopedCommit.pop();","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/buildspec/step/UseTemplateStep.java#L99-L135","documentation":"UseTemplateStep reuses actions defined in a named StepTemplate within the same build spec. The template map is resolved from the build spec (build.getSpec().getStepTemplateMap()); if the referenced templateName is absent, this ExplicitException is thrown before any actions are generated.","triggerScenarios":"A UseTemplateStep whose templateName has no matching 'templates:' entry (StepTemplate) in the build's spec — typically after a typo, deletion, or renaming of the template.","commonSituations":"Renaming a step template but not all UseTemplateStep references; deleting a template that is still used; copying steps between projects/build specs where the template was not copied; YAML indentation causing the template not to be parsed into the map.","solutions":["Add a StepTemplate with the exact name referenced by templateName to the same build spec.","Fix the templateName typo to match an existing template.","Copy the template definition over if the step was moved from another build spec/project.","Check the spec's templates section parses correctly (indentation) so it lands in getStepTemplateMap()."],"exampleFix":"// before\n- type: UseTemplate\n  templateName: maven-build   # template missing\n// after\ntemplates:\n- name: maven-build\n  steps: !<Steps>\n    steps:\n    - !<CommandStep>\n        ...\n- type: UseTemplate\n  templateName: maven-build","handlingStrategy":"validation","validationCode":"// Validate before running\nvar templateMap = build.getSpec().getStepTemplateMap();\nif (!templateMap.containsKey(templateName)) {\n    throw new ExplicitException(\"Available templates: \" + templateMap.keySet() + \"; missing: \" + templateName);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep template definitions and UseTemplateStep references in the same file and review them together.","Rename templates via search-and-replace across the whole build spec.","Verify YAML indentation so templates land in the spec's template map."],"tags":["ci","build-spec","template","config"],"backgroundTag":"resource-not-found","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}