microsoft/semantic-kernel · error · FunctionExecutionException

Error running OpenAPI operation: {operation.id}

Error message

Error running OpenAPI operation: {operation.id}

What it means

The inner executor wraps `await runner.run_operation(...)` in a try/except: any exception while actually running the REST operation (URL building, payload building, transport) is logged with `exc_info=True` and re-raised as `FunctionExecutionException` keyed on `operation.id`. The original traceback is preserved via `from e` and is in the logs.

Source

Thrown at python/semantic_kernel/connectors/openapi_plugin/openapi_manager.py:172

                        f"`{parameter.name}` parameter of the `{plugin_name}.{operation.id}` REST function."
                    )

            options = RestApiRunOptions(
                server_url_override=(
                    execution_parameters.server_url_override
                    if execution_parameters and execution_parameters.server_url_override is not None
                    else None
                ),
                api_host_url=Uri(document_uri).get_left_part() if document_uri is not None else None,
                timeout=execution_parameters.timeout
                if execution_parameters and execution_parameters.timeout is not None
                else None,
            )

            return await runner.run_operation(operation, kernel_arguments, options)
        except Exception as e:
            logger.error(f"Error running OpenAPI operation: {operation.id}", exc_info=True)
            raise FunctionExecutionException(f"Error running OpenAPI operation: {operation.id}") from e

    parameters: list[KernelParameterMetadata] = [
        KernelParameterMetadata(
            name=p.alternative_name or p.name,
            description=f"{p.description or p.name}",
            default_value=p.default_value or "",
            is_required=p.is_required,
            type_=p.type if p.type is not None else TYPE_MAPPING.get(p.type, "object"),
            schema_data=(
                p.schema
                if p.schema is not None and isinstance(p.schema, dict)
                else {"type": f"{p.type}"}
                if p.type
                else None
            ),
        )
        for p in rest_operation_params
    ]

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Inspect logs (the `logger.error(..., exc_info=True)` line) to see the underlying exception.
  2. If it is an SSRF rejection, ensure the resolved URL matches `server_url_validation_allowed_base_urls`.
  3. If it is network/timeout, raise `timeout` in `OpenAPIFunctionExecutionParameters` or fix connectivity.
  4. If it is auth, verify the `auth_callback` returns valid credentials.
  5. Reproduce with a direct `runner.run_operation` call to bypass the wrapper and see the raw error.

Example fix

# before
result = await kernel.invoke(op, KernelArguments(id=1))  # raises 1488

# after: surface the root cause
import logging
logging.getLogger("semantic_kernel.connectors.openapi_plugin").setLevel(logging.DEBUG)
# then re-run; the exc_info traceback shows the real failure (network / SSRF / auth)
Defensive patterns

Strategy: retry

Validate before calling

# pre-flight: ensure URL will validate and network is reachable
from semantic_kernel.connectors.openapi_plugin.server_url_validator import (
    validate_server_url, ServerUrlValidationOptions,
)
await validate_server_url(resolved_url, options)

Try / catch

from semantic_kernel.exceptions import FunctionExecutionException
import logging
logging.getLogger("semantic_kernel.connectors.openapi_plugin").setLevel(logging.DEBUG)

try:
    result = await kernel.invoke(rest_fn, KernelArguments(**kwargs))
except FunctionExecutionException as e:
    if "Error running OpenAPI operation" in str(e):
        # consult logs for exc_info root cause before deciding to retry
        raise
    raise

Prevention

When it happens

Trigger: Runtime failures during invocation: network/HTTP errors, server-URL validation rejection (SSRF guard), payload build failures, timeout, auth callback errors, or response handling errors — all surface as this wrapper for the given operation.

Common situations: The target API is unreachable or returns errors; SSRF guard rejects the resolved URL; the auth callback throws; a timeout is hit; the response cannot be parsed. The message identifies the operation but the cause is in logs.

Related errors


AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13). Data as JSON: /api/errors/88146ffcb5e6a478. Report an issue: GitHub.