apache/iceberg · error · AnalysisException
Missing required parameters
Error message
Missing required parameters: ${missingParamNames.mkString("[", ",", "]")} What it means
Thrown by ResolveProcedures when a CALL does not supply values for all parameters marked required. Named invocation is checked against the name->arg map; any required parameter absent from it triggers this error listing the missing names.
Solutions
- Supply the missing required parameters listed in the error message in your CALL
- Check the procedure signature (SHOW/DESCRIBE procedure docs) to confirm which parameters are required
- If a name was misspelled in the named argument, correct it so it matches the parameter name
Example fix
// before CALL catalog.system.rewrite_data_files(where => 'id > 10') // after CALL catalog.system.rewrite_data_files(table => 'db.t', where => 'id > 10')
Defensive patterns
Strategy: validation
Validate before calling
val requiredNames = procedureParams.filter(_.required).map(_.name).toSet
val providedNames = namedArgs.map(_.name).toSet
val missing = requiredNames -- providedNames
require(missing.isEmpty, s"missing required args: ${missing.mkString(",")}") Try / catch
try { spark.sql(callSql) } catch { case e: AnalysisException if e.getMessage.startsWith("Missing required parameters") => // supply listed params } Prevention
- Always pass mandatory parameters like `table` explicitly by name
- Re-check procedure signatures after Iceberg upgrades — optional/required flags can change
- Use named arguments so omissions are detected with clear messages
When it happens
Trigger: CALL catalog.system.procedure(name => 'x') where the procedure has another required parameter that was not provided (and has no default).
Common situations: Forgetting mandatory args like `table` in system procedures (rewrite_data_files, expire_snapshots); upgrading Iceberg where a parameter changed from optional to required; typos in named-argument names so the value doesn't match any parameter.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Could not build name to arg map
- Named and positional arguments cannot be mixed
- Cannot use catalog : not a ProcedureCatalog
- Too many arguments for procedure
- Wrong arg type for : cannot cast $argType to $paramType
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/149ce6772ff42492.
Report an issue: GitHub.
Appendix: source
Thrown at spark/v3.5/spark-extensions/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveProcedures.scala:92
}
private def buildArgExprs(
params: Seq[ProcedureParameter],
args: Seq[CallArgument]): Seq[Expression] = {
// build a map of declared parameter names to their positions
val nameToPositionMap = params.map(_.name).zipWithIndex.toMap
// build a map of parameter names to args
val nameToArgMap = buildNameToArgMap(params, args, nameToPositionMap)
// verify all required parameters are provided
val missingParamNames = params.filter(_.required).collect {
case param if !nameToArgMap.contains(param.name) => param.name
}
if (missingParamNames.nonEmpty) {
throw new AnalysisException(
s"Missing required parameters: ${missingParamNames.mkString("[", ",", "]")}")
}
val argExprs = new Array[Expression](params.size)
nameToArgMap.foreach { case (name, arg) =>
val position = nameToPositionMap(name)
argExprs(position) = arg.expr
}
// assign nulls to optional params that were not set
params.foreach {
case p if !p.required && !nameToArgMap.contains(p.name) =>
val position = nameToPositionMap(p.name)
argExprs(position) = Literal.create(null, p.dataType)
case _ =>
}
View on GitHub (pinned to 86d9c8fc54)