{"record":{"id":"a365c1bcfc076b3f","repo":"astral-sh/uv","slug":"pip-compile-s-reuse-hashes-is-unsupported-uv","errorCode":null,"errorMessage":"pip-compile's `--reuse-hashes` is unsupported (uv doesn't reuse hashes)","messagePattern":"pip-compile's `--reuse-hashes` is unsupported \\(uv doesn't reuse hashes\\)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/uv-cli/src/compat.rs","lineNumber":80,"sourceCode":"    ///\n    /// This method will warn when an argument is passed that has no effect but matches uv's\n    /// behavior. If an argument is passed that does _not_ match uv's behavior (e.g.,\n    /// `--no-build-isolation`), this method will return an error.\n    fn validate(&self) -> Result<()> {\n        if self.allow_unsafe {\n            warn_user!(\n                \"pip-compile's `--allow-unsafe` has no effect (uv can safely pin `pip` and other packages)\"\n            );\n        }\n\n        if self.no_allow_unsafe {\n            warn_user!(\n                \"pip-compile's `--no-allow-unsafe` has no effect (uv can safely pin `pip` and other packages)\"\n            );\n        }\n\n        if self.reuse_hashes {\n            return Err(anyhow!(\n                \"pip-compile's `--reuse-hashes` is unsupported (uv doesn't reuse hashes)\"\n            ));\n        }\n\n        if self.no_reuse_hashes {\n            warn_user!(\"pip-compile's `--no-reuse-hashes` has no effect (uv doesn't reuse hashes)\");\n        }\n\n        if let Some(resolver) = self.resolver {\n            match resolver {\n                Resolver::Backtracking => {\n                    warn_user!(\n                        \"pip-compile's `--resolver=backtracking` has no effect (uv always backtracks)\"\n                    );\n                }\n                Resolver::Legacy => {\n                    return Err(anyhow!(\n                        \"pip-compile's `--resolver=legacy` is unsupported (uv always backtracks)\"","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/astral-sh/uv/blob/f1a42680ff5272232d65748acf338b19778dde24/crates/uv-cli/src/compat.rs#L62-L98","documentation":"uv accepts pip-tools' CLI flags as hidden compatibility args for `uv pip compile`. `PipCompileCompatArgs::validate()` classifies each flag: flags uv can honor silently are warned about, flags whose semantics uv cannot reproduce return an error. `--reuse-hashes` tells pip-compile to reuse hashes from an existing output file; uv re-resolves and re-fetches hashes every run, so it is rejected rather than silently ignored.","triggerScenarios":"Running `uv pip compile --reuse-hashes requirements.in` (or a wrapper/Makefile/CI job migrated from pip-compile that still passes the flag). `validate()` runs before any resolution work and the process exits with this message.","commonSituations":"Teams switching incremental pip-compile workflows to `uv pip compile` and copying the old flag set; renv-like lockfile refresh scripts that pass `--reuse-hashes` to speed up runs; wrapper tools invoking uv with the same argv they used for pip-compile.","solutions":["Remove `--reuse-hashes` from the invocation; uv always re-resolves and emits fresh hashes.","If you wanted cache speedups, rely on uv's cache (it is already fast) instead of hash reuse.","Audit migrated scripts for other pip-tools flags and drop the ones uv rejects (`--resolver=legacy`, `--max-rounds`, `--config`, `--pip-args`, `--client-cert`, `--emit-trusted-host`, `--emit-options`)."],"exampleFix":"# before\nuv pip compile --reuse-hashes requirements.in\n\n# after\nuv pip compile requirements.in","handlingStrategy":"validation","validationCode":"UNSUPPORTED_COMPILE_FLAGS = {\n    \"--reuse-hashes\", \"--resolver=legacy\", \"--max-rounds\", \"--client-cert\",\n    \"--emit-trusted-host\", \"--config\", \"--emit-options\", \"--pip-args\",\n}\n\ndef check_uv_compile_args(argv: list[str]) -> None:\n    bad = [a for a in argv if a.split(\"=\", 1)[0] in UNSUPPORTED_COMPILE_FLAGS]\n    if bad:\n        raise ValueError(f\"uv pip compile rejects pip-compile flags: {bad}\")","typeGuard":null,"tryCatchPattern":"# when shelling out to uv from tooling\nproc = subprocess.run([\"uv\", \"pip\", \"compile\", *args], capture_output=True, text=True)\nif proc.returncode != 0 and \"unsupported\" in proc.stderr:\n    flag = next((a for a in args if a in UNSUPPORTED_COMPILE_FLAGS), None)\n    if flag:\n        args = [a for a in args if a != flag]  # drop the rejected flag, surface to user\n        raise RuntimeError(f\"dropped unsupported flag {flag}; rerun without it\")","preventionTips":["After migrating from pip-compile, run `uv pip compile` with a clean flag set; add flags back only after checking `uv pip compile --help`.","Keep one canonical compile command in a Makefile/justfile instead of duplicated flags across CI jobs.","uv's compat flags are hidden on purpose: treat 'uv accepted my pip-compile flags' as tested behavior, not an assumption."],"tags":["cli","pip-tools","compatibility","compile"],"backgroundTag":null,"analyzedSha":"f1a42680ff5272232d65748acf338b19778dde24","analyzedAt":"2026-08-16T04:51:47.599Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}