{"record":{"id":"e9de61f73c488515","repo":"apache/beam","slug":"unknown-algorithm-for-input-spec-s-supported-algorithms-are","errorCode":null,"errorMessage":"Unknown algorithm for input_spec: %s. Supported algorithms are \"builtin\" and \"lcg\".","messagePattern":"Unknown algorithm for input_spec: (.+?)\\. Supported algorithms are \"builtin\" and \"lcg\"\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/testing/synthetic_pipeline.py","lineNumber":402,"sourceCode":"        raise ValueError(\n            'SyntheticSource currently only supports delay '\n            'distributions of type \\'const\\'. Received %s.',\n            input_spec['delayDistribution']['type'])\n      self._sleep_per_input_record_sec = (\n          float(input_spec['delayDistribution']['const']) / 1000)\n      if (self._sleep_per_input_record_sec and\n          self._sleep_per_input_record_sec < 1e-3):\n        raise ValueError(\n            'Sleep time per input record must be at least 1e-3.'\n            ' Received: %r',\n            self._sleep_per_input_record_sec)\n    else:\n      self._sleep_per_input_record_sec = 0\n\n    # algorithm of the generator\n    self.gen_algo = input_spec.get('algorithm', None)\n    if self.gen_algo not in (None, 'builtin', 'lcg'):\n      raise ValueError(\n          'Unknown algorithm for input_spec: %s. Supported '\n          'algorithms are \"builtin\" and \"lcg\".',\n          self.gen_algo)\n\n  @property\n  def element_size(self):\n    return self._key_size + self._value_size\n\n  def estimate_size(self):\n    return self._total_size\n\n  def split(self, desired_bundle_size, start_position=0, stop_position=None):\n    # Performs initial splitting of SyntheticSource.\n    #\n    # Exact sizes and distribution of initial splits generated here depends on\n    # the input specification of the SyntheticSource.\n\n    if stop_position is None:","sourceCodeStart":384,"sourceCodeEnd":420,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/testing/synthetic_pipeline.py#L384-L420","documentation":"SyntheticSource supports two random-element generation algorithms: the 'builtin' generator and 'lcg' (linear congruential generator). If input_spec['algorithm'] is set to any other string, __init__ raises ValueError listing the supported values. None (key absent) selects the default builtin generator.","triggerScenarios":"Passing input_spec = {'algorithm': 'mersenne'} or {'algorithm': 'BUILTIN'} (case-sensitive) or any value other than None/'builtin'/'lcg' when constructing the source.","commonSituations":"Typos ('lgc', 'Lcg'); copying algorithm names from other synthetic data tools; assuming case-insensitivity; switching between apache_beam versions where the option exists only in newer releases.","solutions":["Set input_spec['algorithm'] to exactly 'builtin' or 'lcg' (lowercase).","Remove the 'algorithm' key to use the default generator.","Validate the algorithm name against ('builtin', 'lcg') before launching the pipeline."],"exampleFix":"// before\ninput_spec = {'algorithm': 'Lcg'}\n// after\ninput_spec = {'algorithm': 'lcg'}","handlingStrategy":"validation","validationCode":"algo = input_spec.get('algorithm')\nif algo not in (None, 'builtin', 'lcg'):\n    raise ValueError(f'unsupported algorithm: {algo!r}')","typeGuard":"def is_supported_algorithm(spec: dict) -> bool:\n    return spec.get('algorithm') in (None, 'builtin', 'lcg')","tryCatchPattern":"try:\n    source = SyntheticStep(input_spec, ...)\nexcept ValueError as e:\n    if 'Unknown algorithm' in str(e):\n        input_spec.pop('algorithm', None)\n        source = SyntheticStep(input_spec, ...)\n    else:\n        raise","preventionTips":["Use lowercase literal 'builtin' or 'lcg' only","Centralize synthetic-pipeline config construction in one helper with allowed-value checks","Test config generation output against the accepted set {None, 'builtin', 'lcg'}"],"tags":["python","apache-beam","valueerror","synthetic-pipeline","enum"],"backgroundTag":"invalid-enum-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}