astral-sh/ruff · error
`{attr_name}` should have one argument
Error message
`{attr_name}` should have one argument What it means
An unreachable! guard in the flake8-pie multiple-starts-ends-with rule: the let-else matched an expression shape the rule never intends to process (only calls of .startswith/.endswith reach here). Firing it means the rule's visitor let a non-matching expression through.
Source
Thrown at crates/ruff_linter/src/rules/flake8_pie/rules/multiple_starts_ends_with.rs:165
func: _,
arguments:
Arguments {
args,
keywords: _,
range: _,
node_index: _,
},
range_start: _,
node_index: _,
}) = expr
else {
unreachable!(
"{}",
format!("Indices should only contain `{attr_name}` calls")
)
};
args.first()
.unwrap_or_else(|| panic!("`{attr_name}` should have one argument"))
})
.collect();
let node = Expr::Tuple(ast::ExprTuple {
elts: words
.iter()
.flat_map(|value| {
if let Expr::Tuple(tuple) = value {
Left(tuple.iter())
} else {
Right(iter::once(*value))
}
})
.cloned()
.collect(),
ctx: ExprContext::Load,
range: TextRange::default(),
node_index: ruff_python_ast::AtomicNodeIndex::NONE,View on GitHub (pinned to 15f3fe6b15)
Solutions
- Tighten the visitor so only matching call expressions reach the match
- Handle the unexpected shape explicitly instead of unreachable!
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at crates/ruff_linter/src/rules/flake8_pie/rules/multiple_starts_ends_with.rs:165 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of astral-sh/ruff@15f3fe6b15 (2026-09-05).
Data as JSON: /api/errors/28e6656835f23ef1.
Report an issue: GitHub.