{"record":{"id":"39485e95786e5092","repo":"theonedev/onedev","slug":"undefined-param-paramname","errorCode":null,"errorMessage":"Undefined param: ${paramName}","messagePattern":"Undefined param: (.+?)","errorType":"validation","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/util/interpolative/JobVariableInterpolator.java","lineNumber":70,"sourceCode":"\t\t\t\tString paramName;\n\t\t\t\tif (t.startsWith(PREFIX_PARAM))\n\t\t\t\t\tparamName = t.substring(PREFIX_PARAM.length());\n\t\t\t\telse\n\t\t\t\t\tparamName = t.substring(\"params:\".length());\n\n\t\t\t\tfor (Entry<String, Input> entry : paramCombination.getParamInputs().entrySet()) {\n\t\t\t\t\tif (paramName.equals(entry.getKey())) {\n\t\t\t\t\t\tString paramType = entry.getValue().getType();\n\t\t\t\t\t\tList<String> paramValues = new ArrayList<>();\n\t\t\t\t\t\tfor (String value : entry.getValue().getValues()) {\n\t\t\t\t\t\t\tif (paramType.equals(ParamSpec.SECRET))\n\t\t\t\t\t\t\t\tvalue = build.getJobAuthorizationContext().getSecretValue(value);\n\t\t\t\t\t\t\tparamValues.add(value);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn StringUtils.join(paramValues, \",\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthrow new ExplicitException(\"Undefined param: \" + paramName);\n\t\t\t} else if (t.startsWith(PREFIX_PROPERTY) || t.startsWith(\"properties:\")) {\n\t\t\t\tString propertyName;\n\t\t\t\tif (t.startsWith(PREFIX_PROPERTY))\n\t\t\t\t\tpropertyName = t.substring(PREFIX_PROPERTY.length());\n\t\t\t\telse\n\t\t\t\t\tpropertyName = t.substring(\"properties:\".length());\n\n\t\t\t\tJobProperty property = build.getSpec().getPropertyMap().get(propertyName);\n\t\t\t\tif (property != null) {\n\t\t\t\t\treturn property.getValue();\n\t\t\t\t} else {\n\t\t\t\t\tfor (var projectProperty : build.getProject().getHierarchyJobProperties()) {\n\t\t\t\t\t\tif (projectProperty.getName().equals(propertyName))\n\t\t\t\t\t\t\treturn projectProperty.getValue();\n\t\t\t\t\t}\n\t\t\t\t\tthrow new ExplicitException(\"Undefined property: \" + propertyName);\n\t\t\t\t}\n\t\t\t} else if (t.startsWith(PREFIX_SECRET) || t.startsWith(\"secrets:\")) {","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/util/interpolative/JobVariableInterpolator.java#L52-L88","documentation":"JobVariableInterpolator resolves @param:...@ references in job/CI variable expressions against the parameters declared for the build. When the referenced parameter name is not defined for the job/build, it throws ExplicitException 'Undefined param'. The interpolator is strict: only parameters known at build time may be referenced.","triggerScenarios":"An expression like '@param:myParam@' (or 'params:myParam') where 'myParam' is not among the build's declared job parameters — e.g. the parameter was renamed/deleted in the job definition while variable expressions still reference it, or the build was run without that parameter.","commonSituations":"Renaming a job parameter but not updating interpolation expressions; referencing a parameter of a parent job from a child build; typo in the parameter name; running an old build/spec that references removed parameters.","solutions":["Add the missing parameter to the job's parameter definitions so '@param:name@' resolves.","Correct the parameter name in the interpolation expression to match the declared parameter.","Remove the stale @param:...@ reference if the parameter is no longer needed.","If the parameter may be absent, restructure the expression to avoid depending on it or define it with a default value."],"exampleFix":"// before (parameter 'buildNumber' was renamed to 'build_number')\nString expr = \"@param:buildNumber@\";\n// after\nString expr = \"@param:build_number@\";","handlingStrategy":"validation","validationCode":"boolean paramDefined(Build build, String name) {\n    return build.getJob().getParams().stream()\n        .anyMatch(p -> p.getName().equals(name));\n}","typeGuard":null,"tryCatchPattern":"try {\n    value = interpolate(\"@param:foo@\");\n} catch (ExplicitException e) {\n    if (e.getMessage().startsWith(\"Undefined param\")) {\n        value = defaultValue; // or surface a config error to the user\n    } else throw e;\n}","preventionTips":["Keep parameter definitions and interpolation expressions in sync when renaming.","Validate expressions against declared job params before running builds.","Give parameters default values so they are always defined."],"tags":["ci-cd","interpolation","undefined-variable"],"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"}