{"record":{"id":"25fd33cbf798d656","repo":"microsoft/semantic-kernel","slug":"no-argument-provided-for-the-variable-name-ser","errorCode":null,"errorMessage":"No argument provided for the '{variable_name}' server variable of the operation '{self.id}'.","messagePattern":"No argument provided for the '(.+?)' server variable of the operation '(.+?)'\\.","errorType":"exception","errorClass":"FunctionExecutionException","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/connectors/openapi_plugin/models/rest_api_operation.py","lineNumber":298,"sourceCode":"            server_url_string = server_url_override\n        elif self.servers and len(self.servers) > 0:\n            # Use the first server by default\n            server = self.servers[0]\n            server_url_string = server[\"url\"] if isinstance(server, dict) else server\n            server_variables = server.get(\"variables\", {}) if isinstance(server, dict) else {}\n\n            # Substitute server variables if available\n            for variable_name, variable_def in server_variables.items():\n                argument_name = variable_def.get(\"argument_name\", variable_name)\n                allowed_values = variable_def.get(\"enum\")\n                if argument_name in arguments:\n                    value = str(arguments[argument_name])\n                elif \"default\" in variable_def and variable_def[\"default\"] is not None:\n                    # Use the default value if no argument is provided\n                    value = str(variable_def[\"default\"])\n                else:\n                    # Raise an exception if no value is available\n                    raise FunctionExecutionException(\n                        f\"No argument provided for the '{variable_name}' server variable of the operation '{self.id}'.\"\n                    )\n                if allowed_values is not None and value not in allowed_values:\n                    raise FunctionExecutionException(\n                        f\"Value '{value}' for server variable '{variable_name}' is not one of the allowed values.\"\n                    )\n                server_url_string = server_url_string.replace(f\"{{{variable_name}}}\", quote(value, safe=\"\"))\n        elif self.server_url:\n            server_url_string = self.server_url\n        elif api_host_url is not None:\n            server_url_string = api_host_url\n        else:\n            raise FunctionExecutionException(f\"No valid server URL for operation {self.id}\")\n\n        # Ensure the base URL ends with a trailing slash\n        if not server_url_string.endswith(\"/\"):\n            server_url_string += \"/\"\n","sourceCodeStart":280,"sourceCodeEnd":316,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/openapi_plugin/models/rest_api_operation.py#L280-L316","documentation":"When resolving the server URL template, `get_server_url` iterates over declared server variables. For each variable, it uses an explicit argument if provided, falls back to the spec's default, and if neither exists raises this FunctionExecutionException. It indicates a required server URL variable has no value and no default in the OpenAPI spec.","triggerScenarios":"The OpenAPI spec defines a server URL with templated variables (e.g. `https://{host}.example.com/`) but a variable has no default and no argument is supplied at call time. The arguments dict does not contain the variable's `argument_name`.","commonSituations":"Calling an operation whose server URL has variables without providing all variable values. The spec omits defaults for server variables. The argument name for the variable differs from what the caller passes (the spec's `argument_name` extension is used if present).","solutions":["Provide an argument for the server variable using its `argument_name` (or the variable name if no `argument_name` is defined).","Add a `default` value for the variable in the OpenAPI spec.","Use a `server_url_override` to bypass server variable resolution entirely."],"exampleFix":"// before (missing 'region' server variable)\nawait api.call_op()\n// after\nawait api.call_op(region=\"us-east-1\")","handlingStrategy":"validation","validationCode":"def validate_server_variables(operation, arguments: dict):\n    for server in (operation.servers or []):\n        for var_name, var_def in (server.get('variables') or {}).items():\n            arg_name = var_def.get('argument_name', var_name)\n            if arg_name not in arguments and var_def.get('default') is None:\n                raise ValueError(f\"No value for server variable '{var_name}'; provide '{arg_name}' or add a default.\")","typeGuard":null,"tryCatchPattern":"try:\n    result = await api.my_operation(**args)\nexcept FunctionExecutionException as e:\n    if \"server variable\" in str(e) and \"No argument\" in str(e):\n        # provide the missing server variable argument\n        ...","preventionTips":["Provide arguments for all server URL variables that lack defaults in the spec.","Use the variable's argument_name if defined, otherwise the variable name itself.","Add defaults to server variables in the OpenAPI spec where appropriate."],"tags":["openapi","rest-api","server-variables","url","semantic-kernel"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}