Enabling static typing causes includes to no longer be recognized as variable in some scopes
lang/dataflow
## Bug report
When using static typing in a workflow, objects that are the result of an include are sometimes no longer recognized.
### Expected behavior and actual behavior
Using an `include` should cause the variable to be available in all scopes
### Steps to reproduce the problem
With the following `module.nf`:
```groovy
nextflow.enable.types = true
process foo {
input:
x: String
script:
"""
echo "HERE: \$x"
"""
}
```
This `main.nf` works:
```groovy
include { foo } from './module.nf'
workflow {
main:
println("FOO: $foo")
foo("a")
}
```
While this `main.nf` does not work:
```groovy
nextflow.enable.types = true
include { foo } from './module.nf'
workflow {
main:
println("FOO: $foo")
foo("a")
}
```
This is because `foo` is not available as a variable when doing the `println`
### Program output
```
N E X T F L O W ~ version 26.04.2
Launching `./main.nf` [gigantic_wescoff] revision: 387730e4ba
WARN: Static typing is a preview feature -- syntax and behavior may change in future releases
ERROR ~ No such variable: foo
-- Check script 'main.nf' at line: 6 or see '.nextflow.log' file for more details
```
```
May-27 17:50:20.846 [main] DEBUG nextflow.cli.Launcher - $> nextflow run . -main-script ./main.nf
May-27 17:50:20.987 [main] DEBUG nextflow.cli.CmdRun - N E X T F L O W ~ version 26.04.2
May-27 17:50:21.010 [main] DEBUG nextflow.plugin.PluginsFacade - Setting up plugin manager > mode=prod; embedded=false; plugins-dir=/home/<>/.nextflow/plugins; core-plugins: nf-amazon@3.9.1,nf-azure@1.22.4,nf-cloudcache@0.6.0,nf-codecommit@0.5.2,nf-console@1.3.0,nf-google@1.27.2,nf-k8s@1.5.3,nf-seqera@0.20.0,nf-tower@1.27.0,nf-wave@1.20.0
May-27 17:50:21.033 [main] INFO o.pf4j.DefaultPluginStatusProvider - Enabled plugins: []
May-27 17:50:21.034 [main] INFO o.pf4j.DefaultPluginStatusProvider - Disabled plugins: []
May-27 17:50:21.037 [main] INFO org.pf4j.DefaultPluginManager - PF4J version 3.14.1 in 'deployment' mode
May-27 17:50:21.054 [main] DEBUG nextflow.util.RetryConfig - Missing nextflow session - using default retry config
May-27 17:50:21.183 [main] DEBUG nextflow.plugin.PluginUpdater - Using plugin repository: HttpPluginRepository [registry]; url=https://registry.nextflow.io/api
May-27 17:50:21.188 [main] INFO org.pf4j.AbstractPluginManager - No plugins
May-27 17:50:21.211 [main] DEBUG nextflow.config.ConfigBuilder - Found config local: /tmp/nextflow.config
May-27 17:50:21.213 [main] DEBUG nextflow.config.ConfigBuilder - Parsing config file: /tmp/nextflow.config
May-27 17:50:21.216 [main] DEBUG nextflow.config.ConfigParserFactory - Using config parser v2
May-27 17:50:21.231 [main] DEBUG nextflow.config.ConfigBuilder - Applying config profile: `standard`
May-27 17:50:21.569 [main] DEBUG nextflow.plugin.PluginsFacade - Plugins default=[]
May-27 17:50:21.570 [main] DEBUG nextflow.plugin.PluginsFacade - Plugins resolved requirement=[]
May-27 17:50:21.585 [main] DEBUG n.secret.LocalSecretsProvider - Secrets store: /home/<>/.nextflow/secrets/store.json
May-27 17:50:21.588 [main] DEBUG nextflow.secret.SecretsLoader - Discovered secrets providers: [nextflow.secret.LocalSecretsProvider@7b676112] - activable => nextflow.secret.LocalSecretsProvider@7b676112
May-27 17:50:21.630 [main] DEBUG nextflow.cli.CmdRun - Launching `./main.nf` [gigantic_wescoff] - revision: 387730e4ba
May-27 17:50:21.707 [main] DEBUG nextflow.Session - Session UUID: 40c486ef-1203-48b2-9a88-a3998f023565
May-27 17:50:21.708 [main] DEBUG nextflow.Session - Run name: gigantic_wescoff
May-27 17:50:21.708 [main] DEBUG nextflow.Session - Executor pool size: 42
May-27 17:50:21.717 [main] DEBUG nextflow.file.FilePorter - File porter settings maxRetries=3; maxTransfers=50; pollTimeout=null
May-27 17:50:21.722 [main] DEBUG nextflow.util.ThreadPoolBuilder - Creating thread pool 'FileTransfer' minSize=10; maxSize=126; workQueue=LinkedBlockingQueue[-1]; allowCoreThreadTimeout=false
May-27 17:50:21.741 [main] DEBUG nextflow.cli.CmdRun -
Version: 26.04.2 build 12216
Created: 21-05-2026 21:22 UTC
System: Linux 7.0.0-3-pve
Runtime: Groovy 4.0.31 on OpenJDK 64-Bit Server VM 21.0.11+10-1-deb13u2-Debian
Encoding: UTF-8 (UTF-8)
Process: 3688938@di-server [192.168.5.250]
CPUs: 42 - Mem: 503.5 GB (256.7 GB) - Swap: 0 (0)
May-27 17:50:21.762 [main] DEBUG nextflow.Session - Work-dir: /tmp/work [tmpfs]
May-27 17:50:21.762 [main] DEBUG nextflow.Session - Script base path does not exist or is not a directory: /tmp/bin
May-27 17:50:21.771 [main] DEBUG nextflow.executor.ExecutorFactory - Extension executors providers=[]
May-27 17:50:21.781 [main] DEBUG nextflow.Session - Observer factory (v2): LinObserverFactory
May-27 17:50:21.782 [main] DEBUG nextflow.Session - Observer factory (v2): DefaultObserverFactory
May-27 17:50:21.823 [main] DEBUG nextflow.cache.CacheFactory - Using Nextflow cache factory: nextflow.cache.DefaultCacheFactory
May-27 17:50:21.832 [main] DEBUG nextflow.util.CustomThreadPool - Creating default thread pool > poolSize: 43; maxThreads: 1000
May-27 17:50:21.881 [main] DEBUG nextflow.Session - Session start
May-27 17:50:21.886 [main] DEBUG nextflow.script.ScriptLoaderFactory - Using script parser v2
May-27 17:50:22.103 [main] DEBUG nextflow.script.ScriptRunner - > Launching execution
May-27 17:50:22.106 [main] WARN nextflow.script.BaseScript - Static typing is a preview feature -- syntax and behavior may change in future releases
May-27 17:50:22.158 [main] DEBUG nextflow.script.ScriptRunner - Parsed script files:
_nf_script_64b977c86c925ea4: /tmp/module.nf
Main: /tmp/main.nf
May-27 17:50:22.160 [main] DEBUG nextflow.Session - Session aborted -- Cause: No such property: foo for class: nextflow.script.WorkflowBinding
Possible solutions: log
May-27 17:50:22.172 [main] DEBUG n.trace.WorkflowStatsObserver - Workflow completed > WorkflowStats[succeededCount=0; failedCount=0; ignoredCount=0; cachedCount=0; pendingCount=0; submittedCount=0; runningCount=0; retriesCount=0; abortedCount=0; succeedDuration=0ms; failedDuration=0ms; cachedDuration=0ms;loadCpus=0; loadMemory=0; peakRunning=0; peakCpus=0; peakMemory=0; ]
May-27 17:50:22.291 [main] ERROR nextflow.cli.Launcher - @unknown
groovy.lang.MissingPropertyException: No such property: foo for class: nextflow.script.WorkflowBinding
Possible solutions: log
at groovy.lang.Binding.getVariable(Binding.java:56)
at nextflow.script.WorkflowBinding.getVariable(WorkflowBinding.groovy:156)
at groovy.lang.Binding.getProperty(Binding.java:117)
at nextflow.script.WorkflowBinding.getProperty(WorkflowBinding.groovy:141)
at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:167)
at groovy.lang.Closure.getPropertyTryThese(Closure.java:325)
at groovy.lang.Closure.getPropertyDelegateFirst(Closure.java:315)
at groovy.lang.Closure.getProperty(Closure.java:301)
at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
at Main$_runScript_closure1$_closure2.doCall(Main:6)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:280)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1009)
at groovy.lang.Closure.call(Closure.java:433)
at groovy.lang.Closure.call(Closure.java:412)
at nextflow.script.WorkflowDef.run0(WorkflowDef.groovy:204)
at nextflow.script.WorkflowDef.run(WorkflowDef.groovy:187)
at nextflow.script.BindableDef.invoke_a(BindableDef.groovy:51)
at nextflow.script.BaseScript.run0(BaseScript.groovy:271)
at nextflow.script.BaseScript.run(BaseScript.groovy:282)
at nextflow.script.parser.v2.ScriptLoaderV2.runScript(ScriptLoaderV2.groovy:99)
at nextflow.script.parser.v2.ScriptLoaderV2.runScript(ScriptLoaderV2.groovy)
at nextflow.script.ScriptRunner.run(ScriptRunner.groovy:229)
at nextflow.script.ScriptRunner.execute(ScriptRunner.groovy:128)
at nextflow.cli.CmdRun.run(CmdRun.groovy:442)
at nextflow.cli.Launcher.run(Launcher.groovy:526)
at nextflow.cli.Launcher.main(Launcher.groovy:686)
```
### Environment
* Nextflow version: 26.04.2
* Java version: `openjdk 21.0.11 2026-04-21`
* Operating system: Linux 7.0.0-3 x86_64 GNU/Linux
* Bash version: GNU bash, version 5.2.37(1)-release (x86_64-pc-linux-gnu)
1 条评论