wavetermdev/waveterm · error

error reading ready pipe: %w

Error message

error reading ready pipe: %w

What it means

The goroutine scanning the readiness pipe hit a read error (scanner.Err() != nil) instead of receiving the 'Wave-JobManagerStart' signal. The error is forwarded through startCh and returned to the caller, which kills the child process.

Source

Thrown at pkg/wshrpc/wshremote/wshremote_job.go:223

			log.Printf("RemoteStartJobCommand: error reading stdout: %v\n", err)
		} else {
			log.Printf("RemoteStartJobCommand: stdout EOF\n")
		}
	}()

	startCh := make(chan error, 1)
	go func() {
		scanner := bufio.NewScanner(readyPipeRead)
		for scanner.Scan() {
			line := scanner.Text()
			log.Printf("RemoteStartJobCommand: ready pipe line: %s\n", line)
			if strings.Contains(line, "Wave-JobManagerStart") {
				startCh <- nil
				return
			}
		}
		if err := scanner.Err(); err != nil {
			startCh <- fmt.Errorf("error reading ready pipe: %w", err)
		} else {
			log.Printf("RemoteStartJobCommand: ready pipe EOF\n")
			startCh <- fmt.Errorf("job manager exited without start signal")
		}
	}()

	timeoutCtx, cancel := context.WithTimeout(ctx, 5*time.Second)
	defer cancel()

	log.Printf("RemoteStartJobCommand: waiting for start signal\n")
	select {
	case err := <-startCh:
		if err != nil {
			cmd.Process.Kill()
			log.Printf("RemoteStartJobCommand: error from start signal: %v\n", err)
			return nil, err
		}
		log.Printf("RemoteStartJobCommand: received start signal\n")

View on GitHub (pinned to a4447c1563)

Solutions

  1. Check the stderr goroutine logs for the jobmanager's own error output
  2. Ensure the installed wsh binary version supports the jobmanager ready-pipe protocol (re-run 'wsh init')
  3. Retry the job start; if persistent, inspect the wsh binary and its fd-3 usage
Defensive patterns

Strategy: retry

Validate before calling

out, err := exec.Command(wshPath, "--version").CombinedOutput()
if err != nil {
    return fmt.Errorf("wsh binary unusable on remote: %v", err)
}

Try / catch

rtn, err := server.RemoteStartJobCommand(ctx, data)
if err != nil {
    if strings.Contains(err.Error(), "error reading ready pipe") {
        // transient pipe failure: retry once after checking wsh version
    }
    return err
}

Prevention

When it happens

Trigger: Reading fd 3 (the ready pipe inherited via ExtraFiles) fails mid-stream — e.g. the fd was closed unexpectedly, the pipe buffer state is corrupt, or the child manipulated its inherited fd 3.

Common situations: Child process closing or reusing fd 3 incorrectly (version mismatch or a foreign 'wsh' binary); I/O errors on the pipe under extreme system stress.

Related errors


AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01). Data as JSON: /api/errors/05f9ce8a99008822. Report an issue: GitHub.