astral-sh/ruff · error
Invalid `dummy-variable-rgx` value
Error message
Invalid `dummy-variable-rgx` value: {e} What it means
An anyhow error raised when the `dummy-variable-rgx` setting cannot be compiled into a regular expression. The user-provided pattern is syntactically invalid, so the linter cannot build the matcher for dummy variables.
Solutions
- Fix the regex syntax in `dummy-variable-rgx`
- Test the pattern with a regex engine before putting it in configuration
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/ruff_workspace/src/configuration.rs:843 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of astral-sh/ruff@26f38c119c (2026-09-05).
Data as JSON: /api/errors/d0feea7d352b8fa5.
Report an issue: GitHub.
Appendix: source
Thrown at crates/ruff_workspace/src/configuration.rs:843
preview: options.preview.map(PreviewMode::from),
rule_selections: vec![RuleSelection {
select: options.common.select,
ignore,
extend_select: options.common.extend_select.unwrap_or_default(),
fixable: options.common.fixable,
unfixable,
extend_fixable: options.common.extend_fixable.unwrap_or_default(),
}],
extend_safe_fixes: options.common.extend_safe_fixes.unwrap_or_default(),
extend_unsafe_fixes: options.common.extend_unsafe_fixes.unwrap_or_default(),
allowed_confusables: options.common.allowed_confusables,
dummy_variable_rgx: options
.common
.dummy_variable_rgx
.map(|pattern| Regex::new(&pattern))
.transpose()
.map_err(|e| anyhow!("Invalid `dummy-variable-rgx` value: {e}"))?,
extend_per_file_ignores: options
.common
.extend_per_file_ignores
.map(|per_file_ignores| {
per_file_ignores
.into_iter()
.map(|(pattern, prefixes)| {
PerFileIgnore::new(pattern, prefixes, Some(project_root))
})
.collect()
})
.unwrap_or_default(),
external: options.common.external,
ignore_init_module_imports,
explicit_preview_rules: options.common.explicit_preview_rules,
per_file_ignores: options.common.per_file_ignores.map(|per_file_ignores| {
per_file_ignores
.into_iter()View on GitHub (pinned to 26f38c119c)