{"record":{"id":"b1d723a71fb43822","repo":"tensorflow/models","slug":"boundary-must-be-provided-for-strategy","errorCode":null,"errorMessage":"`boundary` must be provided for {} strategy","messagePattern":"`boundary` must be provided for (.+?) strategy","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/nlp/data/pretrain_dataloader.py","lineNumber":508,"sourceCode":"      - 'word_span': Samples spans of words as prediction targets.\n\n    Args:\n      inputs: The input tokens.\n      boundary: The `int` Tensor of indices indicating whole word boundaries.\n        This is used in 'whole_word' and 'word_span'\n\n    Returns:\n      The sampled `bool` input mask.\n\n    Raises:\n      `ValueError`: if `max_predictions_per_seq` is not set or if boundary is\n        not provided for 'whole_word' and 'word_span' sample strategies.\n    \"\"\"\n    if self._max_predictions_per_seq is None:\n      raise ValueError('`max_predictions_per_seq` must be set.')\n\n    if boundary is None and 'word' in self._sample_strategy:\n      raise ValueError('`boundary` must be provided for {} strategy'.format(\n          self._sample_strategy))\n\n    if self._sample_strategy == 'single_token':\n      return self._single_token_mask(inputs)\n    elif self._sample_strategy == 'token_span':\n      return self._token_span_mask(inputs)\n    elif self._sample_strategy == 'whole_word':\n      return self._whole_word_mask(inputs, boundary)\n    elif self._sample_strategy == 'word_span':\n      return self._word_span_mask(inputs, boundary)\n    else:\n      raise NotImplementedError('Invalid sample strategy.')\n\n  def _get_factorization(self, inputs: tf.Tensor, input_mask: tf.Tensor):\n    \"\"\"Samples a permutation of the factorization order.\n\n    Args:\n      inputs: the input tokens.","sourceCodeStart":490,"sourceCodeEnd":526,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/nlp/data/pretrain_dataloader.py#L490-L526","documentation":"Error \"`boundary` must be provided for {} strategy\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/nlp/data/pretrain_dataloader.py:508 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":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}