{"record":{"id":"6e9c610cd916fa69","repo":"astral-sh/uv","slug":"is-not-a-valid-pep-751-filename-expected-py","errorCode":null,"errorMessage":"`{}` is not a valid PEP 751 filename: expected `pylock.toml` or `pylock.<name>.toml`, where `<name>` is non-empty and contains no dots","messagePattern":"`(.+?)` is not a valid PEP 751 filename: expected `pylock\\.toml` or `pylock\\.<name>\\.toml`, where `<name>` is non-empty and contains no dots","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/uv-requirements/src/sources.rs","lineNumber":61,"sourceCode":"        } else if path.ends_with(\"setup.cfg\") {\n            Ok(Self::SetupCfg(path))\n        } else if path.ends_with(\"environment.yml\") {\n            Ok(Self::EnvironmentYml(path))\n        } else if path\n            .file_name()\n            .is_some_and(|file_name| file_name.to_str().is_some_and(is_pylock_toml))\n        {\n            Ok(Self::PylockToml(path))\n        } else if path\n            .extension()\n            .is_some_and(|ext| ext.eq_ignore_ascii_case(\"py\") || ext.eq_ignore_ascii_case(\"pyw\"))\n        {\n            Ok(Self::Pep723Script(path))\n        } else if path\n            .extension()\n            .is_some_and(|ext| ext.eq_ignore_ascii_case(\"toml\"))\n        {\n            Err(anyhow::anyhow!(\n                \"`{}` is not a valid PEP 751 filename: expected `pylock.toml` or `pylock.<name>.toml`, where `<name>` is non-empty and contains no dots\",\n                path.user_display(),\n            ))\n        } else if path\n            .extension()\n            .is_some_and(|ext| ext.eq_ignore_ascii_case(\"txt\") || ext.eq_ignore_ascii_case(\"in\"))\n        {\n            Ok(Self::RequirementsTxt(path))\n        } else if path.extension().is_none() {\n            // If we don't have an extension, mark it as extensionless so we can detect\n            // the format later (either a PEP 723 script or a requirements.txt file).\n            Ok(Self::Extensionless(path))\n        } else {\n            Ok(Self::RequirementsTxt(path))\n        }\n    }\n\n    /// Parse a [`RequirementsSource`] from a `requirements.txt` file.","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/astral-sh/uv/blob/f1a42680ff5272232d65748acf338b19778dde24/crates/uv-requirements/src/sources.rs#L43-L79","documentation":"Error \"`{}` is not a valid PEP 751 filename: expected `pylock.toml` or `pylock.<name>.toml`, where `<name>` is non-empty and contains no dots\" thrown in astral-sh/uv.","triggerScenarios":"Thrown at crates/uv-requirements/src/sources.rs:61 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f1a42680ff5272232d65748acf338b19778dde24","analyzedAt":"2026-08-16T04:51:47.599Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}