chenhg5/cc-connect · error

qoderSession: start: %w

Error message

qoderSession: start: %w

What it means

Send in agent/qoder/session.go fails when cmd.Start() cannot launch the qoder CLI process; the OS-level cause (binary missing, permission denied, working directory nonexistent) is wrapped with %w. This happens after the pipes are set up, just before the readLoop goroutine starts.

Source

Thrown at agent/qoder/session.go:131

	slog.Debug("qoderSession: launching", "resume", sid != "", "args_len", len(args))

	cmd := exec.CommandContext(qs.ctx, qs.cmd, args...)
	cmd.Dir = qs.workDir
	if len(qs.extraEnv) > 0 {
		cmd.Env = core.MergeEnv(os.Environ(), qs.extraEnv)
	}

	stdout, err := cmd.StdoutPipe()
	if err != nil {
		return fmt.Errorf("qoderSession: stdout pipe: %w", err)
	}

	var stderrBuf bytes.Buffer
	cmd.Stderr = &stderrBuf

	if err := cmd.Start(); err != nil {
		return fmt.Errorf("qoderSession: start: %w", err)
	}

	qs.wg.Add(1)
	go qs.readLoop(cmd, stdout, &stderrBuf)

	return nil
}

func (qs *qoderSession) readLoop(cmd *exec.Cmd, stdout io.ReadCloser, stderrBuf *bytes.Buffer) {
	defer qs.wg.Done()

	var gotResult bool
	var nonJSONLines []string

	scanner := bufio.NewScanner(stdout)
	scanner.Buffer(make([]byte, 0, 64*1024), 10*1024*1024)

	for scanner.Scan() {

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Read the wrapped cause: ENOENT -> binary or workDir missing, EACCES -> permissions, ENOEXEC -> wrong binary format
  2. Verify the qoder binary and workDir exist at Send time (os.Stat both)
  3. Use an absolute binary path in config to avoid PATH drift
  4. Check mount noexec flags and architecture of the installed CLI

Example fix

// before
if _, err := os.Stat(qs.workDir); err != nil {
    // Send will fail with start: chdir ...: no such file or directory
}
// after
if _, err := os.Stat(qs.workDir); err != nil {
    os.MkdirAll(qs.workDir, 0o755)
}
Defensive patterns

Strategy: try-catch

Validate before calling

if _, err := os.Stat(qs.workDir); err != nil {
    os.MkdirAll(qs.workDir, 0o755)
}
if _, err := exec.LookPath("qodercli"); err != nil {
    return errors.New("qoder binary missing at send time")
}

Try / catch

if err := session.Send(ctx, msg); err != nil {
    if strings.Contains(err.Error(), "start:") {
        slog.Error("qoder failed to start", "err", err) // inspect wrapped ENOENT/EACCES/ENOEXEC
    }
    return err
}

Prevention

When it happens

Trigger: exec.LookPath passed at New() time but the binary was removed/changed since; the configured workDir does not exist or is not accessible; exec format/permission problems; resource limits (fork failure).

Common situations: Binary uninstalled or PATH altered between session creation and Send; workDir deleted while session alive (e.g. tmpdir cleanup); container without exec permission on the mount; ENOEXEC from a wrong-arch binary.

Related errors


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/e12d37ce66c9b31b. Report an issue: GitHub.