astral-sh/ruff · error · anyhow::Error
`--watch` is not supported with uv workspace integration
Error message
`--watch` is not supported with uv workspace integration
What it means
ty builds `ProjectMetadata` before checking (lib.rs:158-168); `ProjectMetadata::discover` recognizes uv-managed workspaces, and watch mode has no support for the extra resolution uv workspace integration requires. Requesting `--watch` in a project where `has_uv_workspace()` is true is therefore rejected at startup with this message.
Source
Thrown at crates/ty/src/lib.rs:168
.config_file
.as_ref()
.map(|path| SystemPath::absolute(path, &cwd));
let force_exclude = args.force_exclude();
let mut project_metadata = match &config_file {
Some(config_file) => {
ProjectMetadata::from_config_file(config_file.clone(), &project_path, &system)?
}
None if check_paths.iter().any(|path| system.is_file(path)) => {
// `uv check --script` passes a file as its check path. Disable uv workspace metadata
// for scripts until script integration is implemented in a follow-up.
ProjectMetadata::discover_without_uv(&project_path, &system)?
}
None => ProjectMetadata::discover(&project_path, &system)?,
};
if watch && project_metadata.has_uv_workspace() {
return Err(anyhow!(
"`--watch` is not supported with uv workspace integration"
));
}
project_metadata.apply_configuration_files(&system)?;
project_metadata.apply_override_options(args.into_options());
let mut db = ProjectDatabase::fallible(project_metadata, system)?;
let project = db.project();
project.set_verbose(&mut db, verbosity >= VerbosityLevel::Verbose);
project.set_force_exclude(&mut db, force_exclude);
if !check_paths.is_empty() {
project.set_included_paths(&mut db, check_paths);
}
View on GitHub (pinned to 672bb4edf0)
Solutions
- Drop `--watch` and run one-shot checks (`ty check`), re-running on change from your editor or an external file-watcher wrapper
- If you do not actually need workspace semantics, remove the `[tool.uv.workspace]` declaration — then watch mode works again
- Track ty release notes; watch + uv workspace support may arrive in a follow-up
Example fix
# before ty check --watch src/ # after ty check src/ # watch mode unsupported with uv workspace integration
Defensive patterns
Strategy: validation
Validate before calling
if grep -q '^\[tool\.uv\.workspace\]' pyproject.toml 2>/dev/null; then ty check "$@" # uv workspace: no --watch else ty check --watch "$@" fi
Prevention
- Check for `[tool.uv.workspace]` before wiring `--watch` into editor tasks
- Wrap re-runs in an external watcher (entr, watchexec) when watch mode is unavailable
- Watch ty release notes when adopting new uv workspace features
When it happens
Trigger: `ty check --watch` (or any invocation that enables watch) in a repository whose root `pyproject.toml` declares a uv workspace (`[tool.uv.workspace]` with members).
Common situations: Monorepos managed by uv where members share one lockfile; developers adding `--watch` to editor tasks or Justfile recipes after adopting uv workspaces.
Related errors
- The current working directory `{}` contains non-Unicode char
- Provided project path `{project}` is not a directory
- {e}
- Unknown option: {key}
- The `--range` option is only supported when formatting a sin
AI-assisted analysis of astral-sh/ruff@672bb4edf0 (2026-08-16).
Data as JSON: /api/errors/6586533268a9ce4e.
Report an issue: GitHub.