temporalio / temporalio/sdk-python

[Bug] Sending a query that is not registered in the workflow results in an "Encoded failure" when encode_common_attributes=True

Open
#641 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
1.2k
Forks
241
Avg merge
3d 21h
Merged PRs (30d)
55

Description

What are you really trying to do?

List workflow queries using the UI (Queries tab)

image
Describe the bug

The UI shows "Encoded failure" but this is an error thrown by the worker when the UI tries to get the list of queries the workflow exposes with queryType: "@@temporal-internal__list

I get the same error when I use the client to send a query that is not registered in the workflow, and the client configuration has the data_converter which failure_converter_class has encode_common_attributes=True

Minimal Reproduction

Full reproduction is here https://github.com/antmendoza/my-temporal-pocs/tree/main/python/_8156

clone https://github.com/temporalio/samples-python/tree/main/encryption

Add the following modifications:

  • Create a new DefaultFailureConverter with encode_common_attributes=True
class FailureConverterWithDecodedAttributes(temporalio.DefaultFailureConverter):
    def __init__(self) -> None:
        super().__init__(encode_common_attributes=True)
  • Add failure_converter_class=FailureConverterWithDecodedAttributes to the client.
    client = await Client.connect(
        "localhost:7233",
        # Use the default converter, but change the codec
        data_converter=dataclasses.replace(
            temporalio.converter.default(),
            payload_codec=EncryptionCodec(),
            failure_converter_class=FailureConverterWithDecodedAttributes,
        ),
    )

After running a workflow, try to send a query that does not exist for the workflow.

        await client.get_workflow_handle("encryption-workflow-id").query("non-existing-query")

The query will fail with "Encoded failure"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with DefaultFailureConverter and the client workflow-handle query path described in the encryption sample reproduction, focusing on failure_converter_class and encode_common_attributes=True. Re-run the non-existing-query example and verify that an unregistered query reports its underlying failure rather than "Encoded failure".

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.