reportCallIssue.md
April 8, 2026 · View on GitHub
Overview
reportCallIssue is a Pylance and Pyright diagnostic that identifies problems with function and method calls in your Python code. This includes incorrect argument types, missing or extra arguments, and issues with callable objects. The goal is to help you catch mistakes early and ensure your code is type-safe and compatible with static analysis tools.
Representative Issues
- #7106: Use
Annotatedwith valid metadata types that align with the intended static type checking requirements. - #7186: Ensure that the types are explicitly defined and correctly annotated to avoid false positives in static type checking tools like
pyright. - #7362: When overriding methods inherited from a parent class like
MutableMapping, ensure that the method signatures are compatible, especially concerning optional arguments. - #7370: Always use
Annotatedwith specific types rather than attempting to call it directly, unless the intention is to define a new callable type. - #7382: Ensure that the data structure used for initializing dictionaries aligns with the expected types according to the type checker.
- #7470: Avoid using aliases or short-hand notations that might mislead static analysis tools; instead, use the actual class names defined in the library.
- #8017: Ensure a clean and properly installed version of pyright to avoid errors related to corrupted installations.
- #8018: Avoid using dynamic code constructs like
try/exceptin stub files; instead, use direct imports from the appropriate module. - #8377: Ensure Pyright is invoked with the project root directory to maintain correct import resolution behavior, especially when using editable installations within the same environment.
- #8646: Ensure that
TypedDictdefinitions are strictly adhered to when converting between them, usingNotRequiredfor optional keys. - #8777: Ensure that the argument passed to
memoryview.castis of an expected type, using assertions or appropriate checks for code safety and correctness. - #9066: When using
classmethodwithpartial, ensure that the partial application includes all necessary parameters to avoid type errors. - #9316: Use function overloading to clarify type bounds for complex or combined types, especially when dealing with overloaded functions like
np.mean. - #9480: Always provide explicit type annotations for variable assignments to avoid diagnostics errors in static analysis tools like Pyright.
- #9539: Ensure that the types of arguments passed to functions match those expected by the function definition or documentation.
- #9568: When using
type[TypeVar]in function signatures, ensure that type checks are performed correctly withissubclassto avoid runtime errors and incorrect type refinements. - #9606: Ensure to use a stable and recommended version of pyright for best type checking results.
- #9685: Ensure to test new versions of libraries and tools thoroughly before upgrading in production environments.
- #9809: Use specific type annotations instead of unions when calling functions to avoid syntax errors.
Examples
def add(a: int, b: int) -> int:
return a + b
add(1) # Error: Argument missing for parameter "b"
add(1, 2, 3) # Error: Too many positional arguments
Fix — pass the correct number and type of arguments:
add(1, 2) # OK
Example — calling a non-callable:
x: int = 42
x() # Error: Object of type "int" is not callable
Common Fixes & Workarounds
- Double-check function and method signatures for correct argument types and counts.
- Use explicit type annotations for variables and function parameters.
- Avoid using dynamic constructs (like
try/exceptfor imports) in stub files; prefer direct imports. - Use the actual class names from libraries rather than aliases or shorthand notations.
- When using
Annotated, ensure metadata types are valid and used as intended. - For overloaded functions, provide clear and compatible overload signatures.
- Use assertions or type checks to ensure arguments match expected types, especially for functions like
memoryview.cast. - Keep Pyright and Pylance up to date and ensure installations are not corrupted.
- Refer to the Pyright configuration documentation for details on configuring or disabling this diagnostic.
See Also
python.analysis.diagnosticSeverityOverrides— adjust or suppress this diagnosticpython.analysis.typeCheckingMode— controls which diagnostics are enabled by default