Skip to content
This repository was archived by the owner on Feb 23, 2026. It is now read-only.
This repository was archived by the owner on Feb 23, 2026. It is now read-only.

struct.Value fields raise an AttributeError when empty #139

@busunkim96

Description

@busunkim96

Is this the expected behavior? I found it slightly confusing as I was playing with the AIPlatform library googleapis/python-aiplatform#15 (review)

import proto
from google.protobuf import struct_pb2 as struct  # type: ignore

class Slice(proto.Message):
    metrics = proto.Field(proto.MESSAGE, number=4, message=struct.Value,)
>>> Slice.metrics
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: type object 'Slice' has no attribute 'metrics'
>>> Slice.metrics = {"x", 1.3}
>>> Slice.metrics
{'x': 1.3}

Metadata

Metadata

Assignees

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions