{"record":{"id":"86c4295bf1d90415","repo":"theonedev/onedev","slug":"unrecognized-interpolation-variable-t-86c429","errorCode":null,"errorMessage":"Unrecognized interpolation variable: ${t}","messagePattern":"Unrecognized interpolation variable: (.+?)","errorType":"validation","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/util/interpolative/JobVariableInterpolator.java","lineNumber":116,"sourceCode":"\t\t\t\t\tscriptName = t.substring(PREFIX_SCRIPT.length());\n\t\t\t\telse\n\t\t\t\t\tscriptName = t.substring(\"scripts:\".length());\n\n\t\t\t\tMap<String, Object> context = new HashMap<>();\n\t\t\t\tcontext.put(\"build\", build);\n\t\t\t\tObject result = GroovyUtils.evalScriptByName(scriptName, context);\n\t\t\t\tif (result != null)\n\t\t\t\t\treturn result.toString();\n\t\t\t\telse\n\t\t\t\t\treturn \"\";\n\t\t\t} else if (t.startsWith(PREFIX_FILE)) {\n\t\t\t\treturn PLACEHOLDER_PREFIX + WORKDIR + \"/\" + t.substring(PREFIX_FILE.length()) + PLACEHOLDER_SUFFIX;\n\t\t\t} else if (t.startsWith(PREFIX_ATTRIBUTE)) {\n\t\t\t\treturn PLACEHOLDER_PREFIX + ATTRIBUTES + \"/\" + t.substring(PREFIX_ATTRIBUTE.length()) + PLACEHOLDER_SUFFIX;\n\t\t\t} else if (t.equals(JobHelper.PAUSE)) {\n\t\t\t\treturn PLACEHOLDER_PREFIX + JobHelper.PAUSE + PLACEHOLDER_SUFFIX;\n\t\t\t} else {\n\t\t\t\tthrow new ExplicitException(\"Unrecognized interpolation variable: \" + t);\n\t\t\t}\n\t\t});\n\t}\n\t\n\tpublic JobVariableInterpolator(Function<String, String> variableResolver) {\n\t\tthis.variableResolver = variableResolver;\n\t}\n\t\t\n\t@Override\n\tprotected Function<String, String> getVariableResolver() {\n\t\treturn variableResolver;\n\t}\n\n\tpublic static String getHelp() {\n\t\treturn _T(\"<b>Tips: </b> Type <tt>@</tt> to <a href='https://docs.onedev.io/appendix/job-variables' target='_blank' tabindex='-1'>insert variable</a>. \"\n\t\t\t+ \"Use <tt>@@</tt> for literal <tt>@</tt>\");\n\t}\n","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/util/interpolative/JobVariableInterpolator.java#L98-L134","documentation":"JobVariableInterpolator maps each interpolation token to a known prefix (param, property, secret, file, attribute, pause, etc.). When a token matches none of the recognized prefixes/forms, the resolver throws ExplicitException 'Unrecognized interpolation variable'. This is a fallback guard for tokens the current interpolator context cannot resolve.","triggerScenarios":"An @...@ token whose content is not a supported variable form for job variable interpolation — e.g. '@unknown:foo@', a bare token like '@foo@' that is not a built-in variable name, or a valid prefix for a different interpolator (e.g. workspace-only script variables) used in the job-variable context.","commonSituations":"Typos in built-in variable names; copying expressions between OneDev interpolator contexts (job vs workspace) where supported prefixes differ; inventing custom variable syntax without registering a resolver; version changes that renamed built-in variables.","solutions":["Correct the token to a supported variable form (e.g. @param:x@, @property:x@, @secret:x@, @file:x@, @attribute:x@).","Check which interpolator context you are in and use only variables supported there.","Escape literal @ as @@ if the text was never meant to be an interpolation variable.","Consult the OneDev variable documentation for the exact built-in names in your version."],"exampleFix":"// before\nString expr = \"@myvar@\"; // not a built-in job variable\n// after\nString expr = \"@param:myvar@\"; // reference a declared job parameter","handlingStrategy":"validation","validationCode":"private static final Set<String> JOB_PREFIXES = Set.of(\n    \"param:\", \"params:\", \"property:\", \"properties:\",\n    \"secret:\", \"secrets:\", \"file:\", \"attribute:\", \"attributes:\");\nboolean recognizedJobVariable(String t) {\n    return JOB_PREFIXES.stream().anyMatch(t::startsWith);\n}","typeGuard":null,"tryCatchPattern":"try {\n    value = jobInterpolator.interpolate(expr);\n} catch (ExplicitException e) {\n    if (e.getMessage().startsWith(\"Unrecognized interpolation variable\")) {\n        // fix expression or escape @ as @@\n    } else throw e;\n}","preventionTips":["Only use documented built-in variable prefixes in job expressions.","Do not mix workspace-only variables into job-variable interpolation.","Escape literal @ as @@ to avoid accidental variable parsing."],"tags":["ci-cd","interpolation","undefined-variable"],"backgroundTag":"invalid-enum-value","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}