Skip to content

Rejecting the blank task queue names in WorkerFactory.newWorker() - #3031

Open
ad-kat wants to merge 3 commits into
temporalio:mainfrom
ad-kat:oc-for-blank-taskqueue-validation
Open

Rejecting the blank task queue names in WorkerFactory.newWorker()#3031
ad-kat wants to merge 3 commits into
temporalio:mainfrom
ad-kat:oc-for-blank-taskqueue-validation

Conversation

@ad-kat

@ad-kat ad-kat commented Aug 23, 2026

Copy link
Copy Markdown

What was changed

WorkerFactory.newWorker() will now reject blank/whitespace-only task queue names (e.g. " ") in addition to null and empty strings. The error message was updated from "should not be an empty string" to "should not be an empty or blank string" to reflect this. A new test class WorkerFactoryValidationTest covers null, empty, and blank task queue rejection using TestWorkflowEnvironment.

Why?

Strings.isNullOrEmpty(" ") returns false, so whitespace-only task queue names silently passed validation and were forwarded to the Temporal server, producing a cryptic server-side error instead of a clear, early IllegalArgumentException at the call site.

This aligns WorkerFactory with the validation pattern already used elsewhere in this codebase. StartNexusOperationOptions.setId() uses trim().isEmpty() for the same reason.

Checklist

  1. Closes WorkerFactory.newWorker() accepts blank/whitespace-only task queue names #3030
  2. How was this tested: Added WorkerFactoryValidationTest with three unit tests covering null, empty, and blank task queue names. All pass locally using TestWorkflowEnvironment (no external service required).
  3. Any docs updates needed? No.

@ad-kat
ad-kat requested a review from a team as a code owner August 23, 2026 22:29
@CLAassistant

CLAassistant commented Aug 23, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@Quinn-With-Two-Ns Quinn-With-Two-Ns self-assigned this Aug 26, 2026
@Quinn-With-Two-Ns

Copy link
Copy Markdown
Contributor

To be clear you are saying the server reject a blank/whitespace-only task queue name? Can you share the error the server gave? I may want to open an issue on the server to improve the error message in this case

@Quinn-With-Two-Ns

Copy link
Copy Markdown
Contributor

Checking the server code I don't see any logic saying a whitespace-only task queue name is not allowed

@ad-kat

ad-kat commented Aug 28, 2026

Copy link
Copy Markdown
Author

To be clear you are saying the server reject a blank/whitespace-only task queue name? Can you share the error the server gave? I may want to open an issue on the server to improve the error message in this case

Here is a screenshot of the error I receive:
Screenshot 2026-08-27 204618
I tested this against a local Temporal server (v1.31.2). The server does not reject blank task queue names. The worker starts successfully but silently polls a whitespace-only queue that will never receive tasks, causing a silent misconfiguration with no error or warning.

My fix is a defensive validation at the SDK level to catch this before it reaches the server. I made this addition to be consistent with how StartNexusOperationOptions handles blank string inputs.

@ad-kat

ad-kat commented Aug 28, 2026

Copy link
Copy Markdown
Author

Checking the server code I don't see any logic saying a whitespace-only task queue name is not allowed

Temporal's own doc (at docs.temporal.io/best-practices/worker) describes this exact failure mode. Here's the screenshot for it (
Screenshot 2026-08-27 215849

I believe a blank task queue name fits this scenario. It'll be best to catch it at SDK level with clear error message before it becomes a silent prod failure."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WorkerFactory.newWorker() accepts blank/whitespace-only task queue names

3 participants