microsoft/autogen · error · TypeError

All parameters of the function '{f.__name__}' without defaul

Error message

All parameters of the function '{f.__name__}' without default values must be annotated. The annotations are missing for the following parameters: {', '.join(missing_s)}

What it means

Error "All parameters of the function '{f.__name__}' without default values must be annotated. The annotations are missing for the following parameters: {', '.join(missing_s)}" thrown in microsoft/autogen.

Source

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

    return_annotation = get_typed_return_annotation(f)
    missing, unannotated_with_default = get_missing_annotations(typed_signature, required)

    if return_annotation is None:
        logger.warning(
            f"The return type of the function '{f.__name__}' is not annotated. Although annotating it is "
            + "optional, the function should return either a string, a subclass of 'pydantic.BaseModel'."
        )

    if unannotated_with_default != set():
        unannotated_with_default_s = [f"'{k}'" for k in sorted(unannotated_with_default)]
        logger.warning(
            f"The following parameters of the function '{f.__name__}' with default values are not annotated: "
            + f"{', '.join(unannotated_with_default_s)}."
        )

    if missing != set():
        missing_s = [f"'{k}'" for k in sorted(missing)]
        raise TypeError(
            f"All parameters of the function '{f.__name__}' without default values must be annotated. "
            + f"The annotations are missing for the following parameters: {', '.join(missing_s)}"
        )

    fname = name if name else f.__name__

    parameters = get_parameters(required, param_annotations, default_values=default_values)

    function = ToolFunction(
        function=Function(
            description=description,
            name=fname,
            parameters=parameters,
        )
    )

    return function.model_dump()

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Annotate every required parameter

Example fix

def f(x: int, y: str) -> ... for all params without defaults

When it happens

Trigger: Thrown at python/packages/autogen-core/src/autogen_core/_function_utils.py:280 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/3c8b3f7130d4639b. Report an issue: GitHub.