bazelbuild/bazel · error · Undefined

%s is deprecated and will be removed soon. It may be tempora

Error message

%s is deprecated and will be removed soon. It may be temporarily re-enabled by setting --%s=false

What it means

Raised during module resolution when a predeclared name is wrapped in a FlagGuardedValue.onlyWhenIncompatibleFlagIsFalse guard and the corresponding incompatible-change flag is set to true. The symbol is deprecated pending removal; the message names the flag and notes it can be temporarily re-enabled with --<flag>=false.

Source

Thrown at src/main/java/net/starlark/java/eval/Module.java:273

      }
    }
    return m.buildOrThrow();
  }

  /** Implements the resolver's module interface. */
  @Override
  public Resolver.Scope resolve(String name, boolean resolveTypeSyntax) throws Undefined {
    // global?
    if (globalIndex.containsKey(name)) {
      return Resolver.Scope.GLOBAL;
    }

    // predeclared?
    Object v = getPredeclared(name);
    if (v != null) {
      if (v instanceof GuardedValue) {
        // Name is correctly spelled, but access is disabled by a flag or by client data.
        throw new Undefined(((GuardedValue) v).getErrorFromAttemptingAccess(name));
      }
      return Resolver.Scope.PREDECLARED;
    }

    // universal?
    if (Starlark.UNIVERSE.containsKey(name)) {
      return Resolver.Scope.UNIVERSAL;
    }
    if (resolveTypeSyntax && Starlark.UNIVERSE_EXTRA_TYPE_CONSTRUCTORS.containsKey(name)) {
      return Resolver.Scope.UNIVERSAL;
    }

    // undefined
    Set<String> candidates = new HashSet<>();
    candidates.addAll(globalIndex.keySet());
    candidates.addAll(predeclared.keySet());
    candidates.addAll(Starlark.UNIVERSE.keySet());
    if (resolveTypeSyntax) {

View on GitHub (pinned to e6e199d060)

Solutions

  1. Migrate the .bjl code off the deprecated symbol (see the Bazel migration guide for that flag).
  2. As a stopgap, set the named flag to false: bazel build --incompatible_<flag>=false //... — but treat it as temporary, the flag will be removed.
  3. Search the repo for all uses of the symbol to size the migration: grep for the name named in the error message.
  4. Run Bazel's migration tooling / buildifier warnings before the next flag flip.

Example fix

# before (fails when --incompatible_<flag>=true)
ctx.old_api()

# after
ctx.new_api()
Defensive patterns

Strategy: validation

Validate before calling

# temporary: add to invocation until migration completes
# build --incompatible_<name_of_flag>=false

Prevention

When it happens

Trigger: Referencing a legacy builtin whose definition is guarded behind an --incompatible_* flag that your build already enables, e.g. an old rule symbol or removed global once --incompatible_<change> flips to true.

Common situations: Upgrading Bazel (or a rules dependency) where an --incompatible_* flag defaults to true and your .bzl files still reference the legacy API; .bazelrc carrying --incompatible_bzl_disallow_legacy... style flags; migration periods where a repo has half-migrated rules.

Related errors


AI-assisted analysis of bazelbuild/bazel@e6e199d060 (2026-08-14). Data as JSON: /api/errors/339dc6f04a7efe4b. Report an issue: GitHub.