Skip to content

spawn launch fails with "failed to parse JSON" when stdin is a pipe (non-interactive) #34

Closed

Description

@scttfrdmn

Summary

spawn launch fails with failed to parse input: failed to parse JSON: unexpected end of JSON input when called without a TTY (e.g. from a Java subprocess or piped stdin).

Steps to reproduce

# From an EC2 instance, without a TTY:
sudo spawn launch test --instance-type t4g.nano --ami ami-xxx --region us-east-1 --ttl 5m -y
# → failed to parse input: failed to parse JSON: unexpected end of JSON input

echo "" | spawn launch test --instance-type t4g.nano --ami ami-xxx --region us-east-1 --ttl 5m -y
# → same error

Works fine with a real TTY (ssh -t ec2-user@host "spawn launch ...").

Root cause

When stdin is a pipe (not a TTY), spawn interprets stdin as a JSON input stream (truffle pipe mode: truffle search | spawn launch). When the pipe is empty or the caller is a Java thread, the JSON parse fails immediately.

Impact

This blocks nf-spawn (the Nextflow executor plugin) from launching tasks: when Nextflow calls spawn via ProcessBuilder, stdin is a pipe, so every spawn launch call fails.

Expected

spawn launch with explicit flags (--instance-type, --ami, --region, -y) should not try to read JSON from stdin. If stdin is not a TTY and no JSON is received within a timeout, it should proceed with the explicit flags.

Or: add a --no-pipe / --direct flag that suppresses the truffle pipe mode.

Context

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