{"record":{"id":"16fa90937822dd59","repo":"apache/beam","slug":"prohibited-property-name-perhaps-additionalproperties-false","errorCode":null,"errorMessage":"Prohibited property: '{name}'; perhaps additionalProperties: False is missing?","messagePattern":"Prohibited property: '(.+?)'; perhaps additionalProperties: False is missing\\?","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/yaml/json_utils.py","lineNumber":342,"sourceCode":"      if not strong_schema.get('additionalProperties', True):\n        raise ValueError('Incompatible types: map vs object')\n      _validate_compatible(\n          weak_schema['additionalProperties'],\n          strong_schema['additionalProperties'])\n    for required in strong_schema.get('required', []):\n      if required not in weak_schema['properties']:\n        raise ValueError(f\"Missing or unknown property '{required}'\")\n    for name, spec in weak_schema.get('properties', {}).items():\n\n      if name in strong_schema['properties']:\n        try:\n          _validate_compatible(spec, strong_schema['properties'][name])\n        except Exception as exn:\n          raise ValueError(f\"Incompatible schema for '{name}'\") from exn\n      elif not strong_schema.get('additionalProperties', True):\n        # The property is not explicitly in the strong schema, and the strong\n        # schema does not allow for extra properties.\n        raise ValueError(\n            f\"Prohibited property: '{name}'; \"\n            \"perhaps additionalProperties: False is missing?\")\n\n\ndef row_validator(beam_schema: schema_pb2.Schema,\n                  json_schema: dict[str, Any]) -> Callable[[Any], Any]:\n  \"\"\"Returns a callable that will fail on elements not respecting json_schema.\n  \"\"\"\n  if not json_schema:\n    return lambda x: None\n\n  # Validate that this compiles, but avoid pickling the validator itself.\n  _ = jsonschema.validators.validator_for(json_schema)(json_schema)\n  _validate_compatible(beam_schema_to_json_schema(beam_schema), json_schema)\n  validator = None\n\n  convert = row_to_json(\n      schema_pb2.FieldType(row_type=schema_pb2.RowType(schema=beam_schema)))","sourceCodeStart":324,"sourceCodeEnd":360,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/yaml/json_utils.py#L324-L360","documentation":"If the weak schema declares a property that is not present in the strong schema's 'properties', and the strong schema disallows extra properties (additionalProperties falsy), the property is prohibited and this ValueError is raised. The hint suggests the strong schema likely intended to declare additionalProperties: False-based strictness elsewhere or the property should be declared.","triggerScenarios":"row_validator with weak_schema containing property 'x' that strong_schema['properties'] lacks and strong_schema.get('additionalProperties') is False/absent.","commonSituations":"Producer emits extra fields the strict consumer schema doesn't enumerate; adding a new output field to a transform without updating the validating schema; typos in property names between the two schemas.","solutions":["Add the property to the strong schema's 'properties' with the appropriate type spec.","Set 'additionalProperties': True (or a spec) in the strong schema if extra fields are acceptable.","Remove the extra property from the producing transform's output if it should not exist.","Check for typos: the property may exist under a slightly different name in the strong schema."],"exampleFix":"# before\nstrong = {'type': 'object', 'properties': {'a': {'type': 'string'}}}\n# after\nstrong = {'type': 'object', 'properties': {'a': {'type': 'string'}, 'extra': {'type': 'integer'}}}","handlingStrategy":"validation","validationCode":"def prohibited_props(weak, strong):\n    if strong.get('additionalProperties', True):\n        return []\n    return [n for n in weak.get('properties', {}) if n not in strong.get('properties', {})]\nextra = prohibited_props(weak_schema, strong_schema)\nassert not extra, f'prohibited: {extra}'","typeGuard":"def strong_schema_accepts(strong, prop):\n    return strong.get('additionalProperties', True) or prop in strong.get('properties', {})","tryCatchPattern":"try:\n    row_validator(beam_schema, json_schema)\nexcept ValueError as e:\n    if str(e).startswith('Prohibited property'):\n        log.error('Producer emits undeclared field: %s', e)\n    raise","preventionTips":["Update the strong schema whenever a transform gains a new output field.","Avoid additionalProperties: False unless strict field control is genuinely required.","Run schema compatibility checks in CI on every schema edit."],"tags":["python","apache-beam","yaml","json-schema","extra-properties"],"backgroundTag":"schema-validation-failed","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"}