{"record":{"id":"33fcf04bc3e350e5","repo":"astral-sh/uv","slug":"uv-sync-lock-check-requires-a-script-lockfile","errorCode":null,"errorMessage":"`uv sync {lock_check}` requires a script lockfile; run `{}` to lock the script","messagePattern":"`uv sync (.+?)` requires a script lockfile; run `(.+?)` to lock the script","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/uv/src/commands/project/sync.rs","lineNumber":237,"sourceCode":"    // Show the intermediate results if relevant\n    if let Some(message) = sync_report.format(output_format) {\n        writeln!(printer.stderr(), \"{message}\")?;\n    }\n\n    // Special-case: we're syncing a script that doesn't have an associated lockfile. In that case,\n    // we don't create a lockfile, so the resolve-and-install semantics are different.\n    if let SyncTarget::Script(script) = &target {\n        let lockfile = LockTarget::from(script).lock_path();\n        if !lockfile.is_file() {\n            if frozen.is_some() {\n                return Err(anyhow::anyhow!(\n                    \"`uv sync --frozen` requires a script lockfile; run `{}` to lock the script\",\n                    format!(\"uv lock --script {}\", script.path.user_display()).green(),\n                ));\n            }\n\n            if let LockCheck::Enabled(lock_check) = lock_check {\n                return Err(anyhow::anyhow!(\n                    \"`uv sync {lock_check}` requires a script lockfile; run `{}` to lock the script\",\n                    format!(\"uv lock --script {}\", script.path.user_display()).green(),\n                ));\n            }\n\n            // Parse the requirements from the script.\n            let spec = script_specification(\n                script.into(),\n                &settings.resolver,\n                cache,\n                workspace_cache,\n                client_builder.credentials_cache(),\n            )\n            .await?\n            .unwrap_or_default();\n            let script_extra_build_requires = script_extra_build_requires(\n                script.into(),\n                &settings.resolver,","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/astral-sh/uv/blob/f1a42680ff5272232d65748acf338b19778dde24/crates/uv/src/commands/project/sync.rs#L219-L255","documentation":"Error \"`uv sync {lock_check}` requires a script lockfile; run `{}` to lock the script\" thrown in astral-sh/uv.","triggerScenarios":"Thrown at crates/uv/src/commands/project/sync.rs:237 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"}