Skip to content

Fix "Strings must not be null" error message#6404

Merged
bentsherman merged 1 commit intomasterfrom
fix-strings-null-error-message
Sep 16, 2025
Merged

Fix "Strings must not be null" error message#6404
bentsherman merged 1 commit intomasterfrom
fix-strings-null-error-message

Conversation

@bentsherman
Copy link
Member

This PR fixes an error that happens when an invalid entry name is specified and Nextflow tries to suggest alternatives using the closest() function:

nextflow run hello -entry foo

This currently yields the following error:

ERROR ~ Strings must not be null

Stack trace:

java.lang.IllegalArgumentException: Strings must not be null
	at org.apache.commons.lang.StringUtils.getLevenshteinDistance(StringUtils.java:6256)
	at nextflow.extension.Bolts$_closest_closure8.doCall(Bolts.groovy:748)
	at nextflow.extension.Bolts.closest(Bolts.groovy:747)
	at nextflow.script.BaseScript.run0(BaseScript.groovy:168)
	at nextflow.script.BaseScript.run(BaseScript.groovy:193)
	...

With this PR, the correct error message is given:

ERROR ~ Unknown workflow entry name: foo

@bentsherman bentsherman requested a review from jorgee September 15, 2025 20:04
@netlify
Copy link

netlify bot commented Sep 15, 2025

Deploy Preview for nextflow-docs-staging canceled.

Name Link
🔨 Latest commit 6b4c7a6
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs-staging/deploys/68c876d5e579f00008007343

cursor[bot]

This comment was marked as outdated.

@robsyme
Copy link
Collaborator

robsyme commented Sep 15, 2025

Fixes #6405

@bentsherman
Copy link
Member Author

I didn't ask for your opinion cursor

You can't import entry workflows from other modules so it doesn't matter

@robsyme

This comment was marked as resolved.

cursor[bot]

This comment was marked as outdated.

Signed-off-by: Ben Sherman <bentshermann@gmail.com>
@bentsherman bentsherman force-pushed the fix-strings-null-error-message branch from 5d1a39a to 6b4c7a6 Compare September 15, 2025 20:28
@bentsherman

This comment was marked as resolved.

cursor[bot]

This comment was marked as spam.

@robsyme

This comment was marked as resolved.

@bentsherman

This comment was marked as resolved.

@robsyme

This comment was marked as resolved.

@bentsherman bentsherman merged commit 24314b1 into master Sep 16, 2025
27 checks passed
@bentsherman bentsherman deleted the fix-strings-null-error-message branch September 16, 2025 13:29
pditommaso added a commit that referenced this pull request Sep 16, 2025
This commit adds a comprehensive unit test to validate the fix for PR #6404
that prevents "Strings must not be null" errors when an invalid workflow
entry name is specified.

The test verifies that:
- Using an invalid entry name (e.g., `nextflow run script.nf -entry invalidEntry`)
- Correctly throws IllegalArgumentException with proper error message
- Shows "Unknown workflow entry name: invalidEntry" instead of "Strings must not be null"
- Includes suggestions for valid workflow names when available

The test also includes a fix to ensure null workflow names are filtered
out of the imports section in getWorkflowNames(), making the fix comprehensive
for both local definitions and imports.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
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.

"Session aborted -- Cause: Strings must not be null" error when specifying non-existent entry

3 participants