{"record":{"id":"149ce6772ff42492","repo":"apache/iceberg","slug":"missing-required-parameters-missingparamnames-m","errorCode":null,"errorMessage":"Missing required parameters: ${missingParamNames.mkString(\"[\", \",\", \"]\")}","messagePattern":"Missing required parameters: (.+?)","errorType":"exception","errorClass":"AnalysisException","httpStatus":null,"severity":"error","filePath":"spark/v3.5/spark-extensions/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveProcedures.scala","lineNumber":92,"sourceCode":"  }\n\n  private def buildArgExprs(\n      params: Seq[ProcedureParameter],\n      args: Seq[CallArgument]): Seq[Expression] = {\n\n    // build a map of declared parameter names to their positions\n    val nameToPositionMap = params.map(_.name).zipWithIndex.toMap\n\n    // build a map of parameter names to args\n    val nameToArgMap = buildNameToArgMap(params, args, nameToPositionMap)\n\n    // verify all required parameters are provided\n    val missingParamNames = params.filter(_.required).collect {\n      case param if !nameToArgMap.contains(param.name) => param.name\n    }\n\n    if (missingParamNames.nonEmpty) {\n      throw new AnalysisException(\n        s\"Missing required parameters: ${missingParamNames.mkString(\"[\", \",\", \"]\")}\")\n    }\n\n    val argExprs = new Array[Expression](params.size)\n\n    nameToArgMap.foreach { case (name, arg) =>\n      val position = nameToPositionMap(name)\n      argExprs(position) = arg.expr\n    }\n\n    // assign nulls to optional params that were not set\n    params.foreach {\n      case p if !p.required && !nameToArgMap.contains(p.name) =>\n        val position = nameToPositionMap(p.name)\n        argExprs(position) = Literal.create(null, p.dataType)\n      case _ =>\n    }\n","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v3.5/spark-extensions/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveProcedures.scala#L74-L110","documentation":"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.","triggerScenarios":"CALL catalog.system.procedure(name => 'x') where the procedure has another required parameter that was not provided (and has no default).","commonSituations":"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.","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"],"exampleFix":"// before\nCALL catalog.system.rewrite_data_files(where => 'id > 10')\n// after\nCALL catalog.system.rewrite_data_files(table => 'db.t', where => 'id > 10')","handlingStrategy":"validation","validationCode":"val requiredNames = procedureParams.filter(_.required).map(_.name).toSet\nval providedNames = namedArgs.map(_.name).toSet\nval missing = requiredNames -- providedNames\nrequire(missing.isEmpty, s\"missing required args: ${missing.mkString(\",\")}\")","typeGuard":null,"tryCatchPattern":"try { spark.sql(callSql) } catch { case e: AnalysisException if e.getMessage.startsWith(\"Missing required parameters\") => // supply listed params }","preventionTips":["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"],"tags":["spark","sql","call-procedure","named-arguments"],"backgroundTag":"missing-required-argument","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}