{"record":{"id":"b783069b07087dae","repo":"microsoft/semantic-kernel","slug":"no-valid-server-url-for-operation-self-id","errorCode":null,"errorMessage":"No valid server URL for operation {self.id}","messagePattern":"No valid server URL for operation (.+?)","errorType":"exception","errorClass":"FunctionExecutionException","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/connectors/openapi_plugin/models/rest_api_operation.py","lineNumber":311,"sourceCode":"                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\n        return server_url_string  # Return the URL string directly\n\n    def build_path(self, path_template: str, arguments: dict[str, Any]) -> str:\n        \"\"\"Build the path for the operation.\"\"\"\n        parameters = [p for p in self.parameters if p.location == RestApiParameterLocation.PATH]\n        for parameter in parameters:\n            argument = arguments.get(parameter.name)\n            if argument is None:\n                if parameter.is_required:\n                    raise FunctionExecutionException(\n                        f\"No argument is provided for the `{parameter.name}` \"\n                        f\"required parameter of the operation - `{self.id}`.\"\n                    )","sourceCodeStart":293,"sourceCodeEnd":329,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/openapi_plugin/models/rest_api_operation.py#L293-L329","documentation":"In `get_server_url`, if there are no server variables to resolve, the method falls back to `self.server_url`, then `api_host_url`. If none of these three sources provides a server URL, this FunctionExecutionException is raised. It means the operation has no usable server URL from any source.","triggerScenarios":"An operation has no server URL defined (no `servers` in the spec, no `server_url` attribute, no `server_url_override`, and no `api_host_url` passed to the runner). All server URL resolution paths are empty.","commonSituations":"Loading an OpenAPI spec that has no `servers` field and no `host`/`basePath` (older Swagger 2.0 style without host). Forgetting to pass `server_url_override` or `api_host_url` when the spec lacks server info. Plugin runner misconfiguration.","solutions":["Pass a `server_url_override` when invoking the operation or configuring the runner.","Ensure the OpenAPI spec includes a `servers` entry with a valid URL.","Provide `api_host_url` to the OpenAPI runner/operation when loading a spec without server definitions."],"exampleFix":"// before (spec has no servers, no override)\nresult = await api.call_op()\n// after\nresult = await api.call_op(server_url_override=\"https://api.example.com/\")","handlingStrategy":"validation","validationCode":"def has_server_url(operation, server_url_override=None, api_host_url=None):\n    if server_url_override:\n        return True\n    if getattr(operation, 'server_url', None):\n        return True\n    if api_host_url:\n        return True\n    if operation.servers:\n        return True\n    raise ValueError(\"No server URL available; pass server_url_override or api_host_url.\")","typeGuard":null,"tryCatchPattern":"try:\n    result = await api.my_operation(**args)\nexcept FunctionExecutionException as e:\n    if \"No valid server URL\" in str(e):\n        # pass server_url_override when invoking\n        ...","preventionTips":["Pass server_url_override or api_host_url when the spec lacks server definitions.","Ensure the OpenAPI spec includes a servers entry.","Validate server URL availability before invoking operations."],"tags":["openapi","rest-api","server-url","configuration","semantic-kernel"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}