tensorflow/models · error · ValueError

`strategy` should not be None. You need to specify…

Error message

`strategy` should not be None. You need to specify `strategy_type` in the builder contructor or directly set the `strategy` property of the builder.

What it means

State guard in the runtime builder: build/ distribution was requested but self._strategy is still None — neither a strategy_type was given to the constructor nor was the strategy property set directly. The builder cannot fall back to a default strategy and so refuses to proceed.

Solutions

  1. Pass strategy_type (e.g. 'tpu' or 'multi_gpu') to the builder constructor
  2. Or set builder.strategy = <tf.distribute strategy instance> before calling build/ distribute
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at official/legaacy/detection/executor/distributed_executor.py:803 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24). Data as JSON: /api/errors/dc2e92645e6f4a88. Report an issue: GitHub.

Appendix: source

Thrown at official/legacy/detection/executor/distributed_executor.py:803:803

    if self._strategy is None:
      raise ValueError('`strategy` should not be None. You need to specify '
                       '`strategy_type` in the builder contructor or directly '
                       'set the `strategy` property of the builder.')

View on GitHub (pinned to e006f5f0d5)