Skip to content

Misreported error with max_compatibility_level violation #22972

@Wyverald

Description

@Wyverald

// levels), we try the next resolution strategy. When all strategies are exhausted, we know
// there is no way to achieve a valid selection result, so we report the failure from the time
// we attempted to walk the graph using the first resolution strategy.

As the comment above describes, we report the error we see when we tried the first resolution strategy. But this error could be confusing since it could point blame at a bazel_dep that has the right max_compatibility_level set.

See https://github.com/Wyverald/max_compat_level_repro for a repro (Bazel 7.2.1): root depends on foo@1 and bar@2. foo@1 depends on bar@1, with max_compatibility_level=2. This is all fine (we end up using bar@2). But if root adds a new dependency on quux@1 which has a dependency on bar@1, we run into an error (correctly). However, the error we report points blame at the foo@1 -> bar@1 (max_compat=2) edge.

It's unclear to me yet how to report a "sensible" error here -- will need to think a bit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3We're not considering working on this, but happy to review a PR. (No assignee)area-BzlmodBzlmod-specific PRs, issues, and feature requestsbad error messagingIssues where users get stuck because they don't understand what they did wrongteam-ExternalDepsExternal dependency handling, remote repositiories, WORKSPACE file.type: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions