microsoft/autogen · error · ValueError

No annotation

Error message

No annotation

What it means

Error "No annotation" thrown in microsoft/autogen.

Source

Thrown at python/packages/autogen-core/src/autogen_core/_function_utils.py:316


def normalize_annotated_type(type_hint: Type[Any]) -> Type[Any]:
    """Normalize typing.Annotated types to the inner type."""
    if get_origin(type_hint) is Annotated:
        # Extract the inner type from Annotated
        return get_args(type_hint)[0]  # type: ignore
    return type_hint


def args_base_model_from_signature(name: str, sig: inspect.Signature) -> Type[BaseModel]:
    fields: Dict[str, tuple[Type[Any], Any]] = {}
    for param_name, param in sig.parameters.items():
        # This is handled externally
        if param_name == "cancellation_token":
            continue

        if param.annotation is inspect.Parameter.empty:
            raise ValueError("No annotation")

        type = normalize_annotated_type(param.annotation)
        description = type2description(param_name, param.annotation)
        default_value = param.default if param.default is not inspect.Parameter.empty else PydanticUndefined

        fields[param_name] = (type, Field(default=default_value, description=description))

    return cast(BaseModel, create_model(name, **fields))  # type: ignore

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Add a type annotation to the parameter

Example fix

def f(x: int): ...

When it happens

Trigger: Thrown at python/packages/autogen-core/src/autogen_core/_function_utils.py:316 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15). Data as JSON: /api/errors/faa4530984a86a8f. Report an issue: GitHub.