{"record":{"id":"576499a27c10978a","repo":"astral-sh/ruff","slug":"cannot-set-default-value-for-variadic-parameter","errorCode":null,"errorMessage":"cannot set default value for variadic parameter","messagePattern":"cannot set default value for variadic parameter","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/ty_python_semantic/src/types/signatures.rs","lineNumber":5611,"sourceCode":"        self.annotated_type = inferred_type;\n        self.inferred_annotation = true;\n        self\n    }\n\n    pub(crate) fn with_starred_annotation(mut self) -> Self {\n        self.annotation_kind = ParameterAnnotationKind::Starred;\n        self\n    }\n\n    pub(crate) fn with_default_type(mut self, default: Type<'db>) -> Self {\n        match &mut self.kind {\n            ParameterKind::PositionalOnly { default_type, .. }\n            | ParameterKind::PositionalOrKeyword { default_type, .. }\n            | ParameterKind::KeywordOnly { default_type, .. } => {\n                *default_type = Some(ParameterDefault::Inferred(default));\n            }\n            ParameterKind::Variadic { .. } | ParameterKind::KeywordVariadic { .. } => {\n                panic!(\"cannot set default value for variadic parameter\")\n            }\n        }\n        self\n    }\n\n    pub(crate) fn with_optional_default_type(self, default: Option<Type<'db>>) -> Self {\n        if let Some(default) = default {\n            self.with_default_type(default)\n        } else {\n            self\n        }\n    }\n\n    /// Set the source definition represented by this parameter.\n    pub(crate) fn with_definition(mut self, definition: Option<Definition<'db>>) -> Self {\n        self.definition = definition;\n        self\n    }","sourceCodeStart":5593,"sourceCodeEnd":5629,"githubUrl":"https://github.com/astral-sh/ruff/blob/15f3fe6b15a5f00172f34b0f542f8ea277f5a586/crates/ty_python_semantic/src/types/signatures.rs#L5593-L5629","documentation":"Fires in the parameter-signature builder when with_default_type is called on a variadic (*args-style) parameter. Variadic parameters cannot carry defaults in Python, so the builder rejects the operation; reaching it means the caller constructed an invalid signature.","triggerScenarios":"Thrown at crates/ty_python_semantic/src/types/signatures.rs:5523 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Only call with_default_type for positional-only, positional-or-keyword, or keyword-only parameters","Model variadic defaults separately or reject them at the call site"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"15f3fe6b15a5f00172f34b0f542f8ea277f5a586","analyzedAt":"2026-09-05T10:32:37.492Z","contentChangedAt":"2026-09-05T10:32:37.492Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}