AlexxIT/go2rtc · error

exec/pipe

Error message

exec/pipe: %w
%s

What it means

handlePipe wraps magic.Open failure: the spawned command started, but its stdout could not be recognized as any known stream format (magic detection failed). The error wraps the detection error and appends cmd.Stderr, so the helper program's own error output shows why it produced unusable data.

Solutions

  1. Read the appended stderr — usually the helper's own error (bad args, missing lib)
  2. Fix the source/args so the command emits a recognized format on stdout
  3. Check the command's PATH and environment in the exec context
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at internal/exec/exec.go:157 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07). Data as JSON: /api/errors/7b3c7e5f4115d606. Report an issue: GitHub.

Appendix: source

Thrown at internal/exec/exec.go:157

		io.Closer
	}{
		// add buffer for pipe reader to reduce syscall
		bufio.NewReaderSize(stdout, core.BufferSize),
		// stop cmd on close pipe call
		cmd,
	}

	log.Debug().Strs("args", cmd.Args).Msg("[exec] run pipe")

	ts := time.Now()

	if err = cmd.Start(); err != nil {
		return nil, err
	}

	prod, err := magic.Open(rd)
	if err != nil {
		return nil, fmt.Errorf("exec/pipe: %w\n%s", err, cmd.Stderr)
	}

	if info, ok := prod.(core.Info); ok {
		info.SetProtocol("pipe")
		setRemoteInfo(info, source, cmd.Args)
	}

	log.Debug().Stringer("launch", time.Since(ts)).Msg("[exec] run pipe")

	return prod, nil
}

func handleRTSP(source string, cmd *shell.Command, path string, timeout time.Duration) (core.Producer, error) {
	if log.Trace().Enabled() {
		cmd.Stdout = os.Stdout
	}

	waiter := make(chan *pkg.Conn, 1)

View on GitHub (pinned to c245815e75)