Skip to content

--user-data passed as bare path → task script baked in as literal inline string, never runs #13

Closed

Description

@scttfrdmn

Summary

SpawnTaskHandler.submit() writes the task script to a temp file and passes it to spawn as a bare path:

'--user-data', scriptFile.toString(),   // SpawnTaskHandler.groovy:56

But spawn's --user-data flag means "@file or inline". A value without a leading @ is treated as inline user-data, not a file to read:

// spawn cmd/launch.go:1938-1952
} else if userData != "" {
    if strings.HasPrefix(userData, "@") {
        path := userData[1:]
        data, _ := os.ReadFile(path)
        customUserData = string(data)
    } else {
        customUserData = userData   // <-- bare path baked in literally
    }
}

So spawn bakes the literal string /tmp/nf-spawn-nf-xxx-….sh into the instance's user-data instead of the script contents. The task body never executes on the instance.

Fix

Either:

  • Prefix with @: '--user-data', '@' + scriptFile.toString(), or
  • Use the dedicated --user-data-file flag, which reads the file unconditionally (spawn cmd/launch.go:1928). This is the clearer intent.

Test

Assert the launch command nf-spawn builds either starts the --user-data value with @ or uses --user-data-file, so a bare path can't regress.

Context

Found while diagnosing #12 (tasks stuck PENDING). This is the trivial half; the substantive blocker is output staging (separate issue). Split out from #12.

Activity

  1. added
    bug
    on Jun 3, 2026
  2. added a commit that references this issue on Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions