{"record":{"id":"9cba5566649a5686","repo":"apache/beam","slug":"missing-parameters-in-model-handler-missing-params","errorCode":null,"errorMessage":"Missing parameters in model_handler: {missing_params}","messagePattern":"Missing parameters in model_handler: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/yaml/yaml_ml.py","lineNumber":561,"sourceCode":"      see which args are allowed.\n\n  \"\"\"\n\n  options.YamlOptions.check_enabled(pcoll.pipeline, 'ML')\n\n  if not isinstance(model_handler, dict):\n    raise ValueError(\n        'Invalid model_handler specification. Expected dict but was '\n        f'{type(model_handler)}.')\n  expected_model_handler_params = {'type', 'config'}\n  given_model_handler_params = set(\n      SafeLineLoader.strip_metadata(model_handler).keys())\n  extra_params = given_model_handler_params - expected_model_handler_params\n  if extra_params:\n    raise ValueError(f'Unexpected parameters in model_handler: {extra_params}')\n  missing_params = expected_model_handler_params - given_model_handler_params\n  if missing_params:\n    raise ValueError(f'Missing parameters in model_handler: {missing_params}')\n  typ = model_handler['type']\n  model_handler_provider_type = ModelHandlerProvider.handler_types.get(\n      typ, None)\n  if not model_handler_provider_type:\n    raise NotImplementedError(f'Unknown model handler type: {typ}.')\n\n  model_handler_provider = ModelHandlerProvider.create_handler(model_handler)\n  model_handler_provider.validate(model_handler['config'])\n  schema = RowTypeConstraint.from_fields(\n      named_fields_from_element_type(pcoll.element_type) +\n      [(str(inference_tag), model_handler_provider.inference_output_type())])\n\n  return (\n      pcoll | RunInference(\n          model_handler=KeyedModelHandler(\n              model_handler_provider.underlying_handler()).with_preprocess_fn(\n                  model_handler_provider._preprocess_fn_internal()).\n          with_postprocess_fn(","sourceCodeStart":543,"sourceCodeEnd":579,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/yaml/yaml_ml.py#L543-L579","documentation":"The YAML run_inference wrapper found the model_handler spec missing required keys (only 'type' and 'config' are expected); the missing key names are interpolated so the user knows exactly what to add to the YAML.","triggerScenarios":"model_handler dict given with only 'type' but no 'config', or only 'config' but no 'type', e.g. {'type': 'VertexAI'} without config.","commonSituations":"Omitting the config block when all defaults apply; forgetting the type key when only options are supplied; YAML nodes dropped due to bad indentation; programmatic dict built conditionally.","solutions":["Add the missing 'type' key naming the handler","Add the missing 'config' key (use an empty dict {} if all defaults suffice)","Verify YAML indentation nests both keys under model_handler"],"exampleFix":"# before\nmodel_handler:\n  type: VertexAI\n# after\nmodel_handler:\n  type: VertexAI\n  config:\n    endpoint_id: '123'\n    project: 'my-project'","handlingStrategy":"validation","validationCode":"def check_handler_required(handler):\n    missing = {'type', 'config'} - set(handler)\n    if missing:\n        raise ValueError(f'model_handler missing: {missing}')","typeGuard":"def is_complete_handler_spec(h):\n    return isinstance(h, dict) and {'type', 'config'} <= set(h)","tryCatchPattern":null,"preventionTips":["Always include both 'type' and 'config' (even empty {})","Validate spec dicts before constructing transforms","Check YAML nesting so keys are not dropped"],"tags":["python","apache-beam","yaml","validation","ml"],"backgroundTag":"missing-required-config-field","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}