{"record":{"id":"cee4aad19831ea20","repo":"xai-org/x-algorithm","slug":"beam-width-must-be-1-got-self-beam-width-us","errorCode":null,"errorMessage":"beam_width must be >= 1, got {self.beam_width}. Use --beam_width=N on the launch command.","messagePattern":"beam_width must be >= 1, got (.+?)\\. Use --beam_width=N on the launch command\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"phoenix/xrex/inference/sid_retrieval_runner.py","lineNumber":76,"sourceCode":"\n@configclass\nclass SidRetrievalModelRunner(\n    BaseModelRunner[\n        xai_recsys_engine.RetrieveRequestBatch,\n        RecsysSIDRetrievalConfig,\n    ]\n):\n    sid_retrieval_forward_jit: JittedOrCompiled | None = None\n    sid_retrieval_forward_fn: hk.Transformed | None = None\n    beam_width: int = 1\n    decode_levels: int = 0\n\n    _corpus: _CorpusView | None = None\n\n    def _setup_sid_retrieval_jit(self) -> None:\n        assert isinstance(self.model_config, RecsysSIDRetrievalConfig)\n        if self.beam_width < 1:\n            raise ValueError(\n                f\"beam_width must be >= 1, got {self.beam_width}. \"\n                \"Use --beam_width=N on the launch command.\"\n            )\n        logger.info(\n            \"Setting up SID retrieval JIT: beam_width=%d \"\n            \"sid_num_levels=%d sid_codebook_size=%d corpus_size=%d large_k=%d\",\n            self.beam_width,\n            self.model_config.sid_num_levels,\n            self.model_config.sid_codebook_size,\n            self._corpus.num_posts if self._corpus is not None else 0,\n            self.large_k,\n        )\n\n        _ht = self.model_config.hash_table.hash_keys\n        _hist_post_seq = _ht.num_item_hashes * self.history_seq_len\n        _hist_auth_seq = _ht.num_author_hashes * self.history_seq_len\n        _cand_post_seq = _ht.num_item_hashes * self.candidate_seq_len\n        _cand_auth_seq = _ht.num_author_hashes * self.candidate_seq_len","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/phoenix/xrex/inference/sid_retrieval_runner.py#L58-L94","documentation":"Raised by _setup_sid_retrieval_jit during SID (semantic ID) retrieval setup, which runs as part of checkpoint loading (maybe_load_checkpoint). The runner validates that beam_width, the beam-search width for the RIPS/SID retrieval index, is at least 1 before building the JIT-compiled retrieval pipeline. A value of 0 or negative would make beam search degenerate, so it fails fast with an actionable message pointing at the launch flag.","triggerScenarios":"Launching inference/training with --beam_width=0 (or a negative value) on the launch command, or constructing the runner with a beam_width defaulting to 0 via config, when maybe_load_checkpoint triggers _setup_sid_retrieval_jit.","commonSituations":"Copy-pasted launch commands where beam_width was set to 0 to 'disable' beam search; config files with beam_width: 0 meaning 'use default'; a sweep script enumerating beam widths starting at 0.","solutions":["Set --beam_width=1 (greedy) or higher on the launch command.","Check the runner/config constructor for a beam_width field defaulting to 0 and override it.","If beam_width comes from a sweep or generated config, clamp it with max(1, beam_width) before launch."],"exampleFix":"# before\n--beam_width=0\n\n# after\n--beam_width=4","handlingStrategy":"validation","validationCode":"beam_width = int(os.environ.get(\"BEAM_WIDTH\", 1))\nassert beam_width >= 1, f\"beam_width must be >= 1, got {beam_width}\"","typeGuard":"def is_valid_beam_width(bw) -> bool:\n    return isinstance(bw, int) and not isinstance(bw, bool) and bw >= 1","tryCatchPattern":null,"preventionTips":["Validate launch flags in a preflight check before starting the run.","Clamp generated/sweep beam widths with max(1, beam_width)."],"tags":["sid-retrieval","beam-search","config-validation","launch-flags"],"backgroundTag":"invalid-config-value","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}