GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: Improve `Any` decode error by MarkDaoust · Pull Request #712 · googleapis/python-api-core

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

Conversation

@MarkDaoust

@MarkDaoust MarkDaoust commented Oct 1, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Was (useless):

TypeError: Could not convert Any to TimeOfDay

Now:

TypeError: Could not convert `google.protobuf.any_pb2.Any` with underlying type `google.type.Date` to `google.type.TimeOfDay`

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue: from_any_pb gives a useless error message when the type names don't match. #711
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #711 🦕

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@MarkDaoust
Improve Any decoding-error.
9e01e2e
Was:

TypeError: Could not convert Any to PredictLongRunningResponse

Now:

TypeError: Could not convert
   Any[google.ai.generativelanguage.v1main.PredictLongRunningResponse] to
       google.ai.generativelanguage.v1beta.PredictLongRunningResponse
@MarkDaoust
MarkDaoust requested review from a team October 1, 2024 23:53
@product-auto-label product-auto-label Bot added the size: xs Pull request size is extra small. label Oct 1, 2024
@blunderbuss-gcf blunderbuss-gcf Bot assigned vchudnov-g Oct 1, 2024
@ohmayr

ohmayr commented Oct 4, 2024

Copy link
Copy Markdown
Contributor

@MarkDaoust Hmm looking at your comment above, is this right syntax Any[google.ai.generativelanguage.v1main.PredictLongRunningResponse] for Python?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ohmayr
ohmayr reviewed Oct 4, 2024
View reviewed changes
Comment thread google/api_core/protobuf_helpers.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@ohmayr ohmayr changed the title Improve Any decoding-error. chore: Improve Any decode error Oct 4, 2024
@conventional-commit-lint-gcf

conventional-commit-lint-gcf Bot commented Oct 4, 2024

Copy link
Copy Markdown

🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use automerge label. Good luck human!

-- conventional-commit-lint bot
https://conventionalcommits.org/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@parthea parthea self-assigned this Oct 9, 2024
@parthea
Merge branch 'main' into any-error
acb97ca
@parthea parthea changed the title chore: Improve Any decode error fix: Improve Any decode error Oct 9, 2024
@parthea
update test
7f9a7b9
@product-auto-label product-auto-label Bot added size: s Pull request size is small. and removed size: xs Pull request size is extra small. labels Oct 9, 2024
@parthea parthea assigned ohmayr and unassigned parthea and vchudnov-g Oct 9, 2024
@parthea
parthea requested a review from ohmayr October 9, 2024 17:06
@parthea parthea added the process: review requested label Oct 9, 2024
parthea added 2 commits October 9, 2024 17:30
@parthea
update error message
7bce39d
@parthea
Merge branch 'main' into any-error
7a1e1d0
ohmayr
ohmayr approved these changes Oct 21, 2024
View reviewed changes
Comment thread tests/unit/test_protobuf_helpers.py Outdated
with pytest.raises(
TypeError,
match=re.escape(
"Could not convert `google.protobuf.any_pb2.Any` with underlying type `google.type.Date` to `google.type.TimeOfDay`"

@ohmayr ohmayr Oct 21, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I reading this correct or should it instead be the following? (My assumption is that the underlying type should be Any).

Suggested change
"Could not convert `google.protobuf.any_pb2.Any` with underlying type `google.type.Date` to `google.type.TimeOfDay`"
"Could not convert `google.type.Date` with underlying type `google.protobuf.any_pb2.Any` to `google.type.TimeOfDay`"

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@parthea parthea Oct 22, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in dc33849

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
parthea added 2 commits October 22, 2024 14:19
@parthea
address review feedback
dc33849
@parthea
Merge branch 'main' into any-error
3e7844c
@parthea parthea removed the process: review requested label Oct 22, 2024
@parthea
parthea enabled auto-merge (squash) October 22, 2024 14:23
@parthea
parthea merged commit 0d5ed37 into googleapis:main Oct 22, 2024
@release-please release-please Bot mentioned this pull request Oct 22, 2024
chore(main): release 2.22.0 #729
Merged
@parthea parthea mentioned this pull request Oct 23, 2024
chore: Release candidate v2.22.0rc0 #745
Closed
This was referenced May 30, 2025
chore(main): release 2.0.0 #822
Closed
chore(main): release 2.0.0 #823
Closed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

2 more reviewers
@parthea parthea parthea left review comments
@ohmayr ohmayr ohmayr approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@ohmayr ohmayr

Labels

size: s Pull request size is small.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

from_any_pb gives a useless error message when the type names don't match.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@MarkDaoust @ohmayr @parthea @vchudnov-g
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.