{"record":{"id":"92ec4be791069cb7","repo":"apache/beam","slug":"unexpected-keyword-arguments-join-kwargs","errorCode":null,"errorMessage":"Unexpected keyword arguments: {', '.join(kwargs)}","messagePattern":"Unexpected keyword arguments: (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/ml/rag/ingestion/bigquery.py","lineNumber":76,"sourceCode":"      ...       {'name': 'source_url', 'type': 'STRING'}\n      ...     ]\n      ...   },\n      ...   embeddable_to_dict_fn=lambda item: {\n      ...       'id': item.id,\n      ...       'embedding': item.embedding.dense_embedding,\n      ...       'source_url': item.metadata.get('url')\n      ...   }\n      ... )\n    \"\"\"\n    self.schema = schema\n    if 'chunk_to_dict_fn' in kwargs:\n      warnings.warn(\n          \"chunk_to_dict_fn is deprecated, use embeddable_to_dict_fn\",\n          DeprecationWarning,\n          stacklevel=2)\n      embeddable_to_dict_fn = kwargs.pop('chunk_to_dict_fn')\n    if kwargs:\n      raise TypeError(f\"Unexpected keyword arguments: {', '.join(kwargs)}\")\n    if embeddable_to_dict_fn is None:\n      raise TypeError(\"SchemaConfig requires embeddable_to_dict_fn\")\n    self.embeddable_to_dict_fn = embeddable_to_dict_fn\n\n\nclass BigQueryVectorWriterConfig(VectorDatabaseWriteConfig):\n  def __init__(\n      self,\n      write_config: dict[str, Any],\n      *,  # Force keyword arguments\n      schema_config: Optional[SchemaConfig] = None):\n    \"\"\"Configuration for writing vectors to BigQuery using managed transforms.\n    \n    Supports both default schema (id, embedding, content, metadata columns) and\n    custom schemas through SchemaConfig.\n\n    Example with default schema:\n      >>> config = BigQueryVectorWriterConfig(","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/ml/rag/ingestion/bigquery.py#L58-L94","documentation":"The BigQuery RAG ingestion SchemaConfig __init__ accepts known keyword arguments plus the deprecated chunk_to_dict_fn alias; any remaining unexpected kwargs raise a TypeError listing them. This guards against silently ignored misnamed options.","triggerScenarios":"Calling SchemaConfig(...) with keyword arguments other than embeddable_to_dict_fn / metadata_fn-style accepted params, or the legacy chunk_to_dict_fn.","commonSituations":"Typos like embeddable_to_dict_func; passing writer options (table, project) into SchemaConfig instead of BigQueryVectorWriterConfig; old code still passing removed parameters.","solutions":["Remove or correct the unexpected keyword arguments listed in the message","Move write-related options (table etc.) into BigQueryVectorWriterConfig/write_config","Replace legacy chunk_to_dict_fn with embeddable_to_dict_fn (the only accepted alias)"],"exampleFix":"// before\nSchemaConfig(embeddable_to_dct_fn=fn)  # typo -> unexpected kwarg\n// after\nSchemaConfig(embeddable_to_dict_fn=fn)","handlingStrategy":"validation","validationCode":"ALLOWED = {'embeddable_to_dict_fn', 'chunk_to_dict_fn'}\nunknown = set(kwargs) - ALLOWED\nassert not unknown, f'unexpected SchemaConfig kwargs: {unknown}'","typeGuard":"def valid_schema_config_kwargs(kwargs: dict) -> bool:\n    return not (set(kwargs) - {'embeddable_to_dict_fn', 'chunk_to_dict_fn'})","tryCatchPattern":"try:\n    sc = SchemaConfig(**opts)\nexcept TypeError as e:\n    if str(e).startswith('Unexpected keyword arguments'): retry_with_cleaned_kwargs(opts)\n    else: raise","preventionTips":["Check the SchemaConfig signature before passing **opts","Put write options in BigQueryVectorWriterConfig, not SchemaConfig","Migrate chunk_to_dict_fn to embeddable_to_dict_fn"],"tags":["python","apache-beam","bigquery","rag","type-error"],"backgroundTag":"invalid-argument","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"}