larksuite/cli · error

exec provider exited with error

Error message

exec provider exited with error: %w

What it means

cmd.Run returned a non-nil error and the context deadline had NOT expired, so the provider process itself failed - virtually always a non-zero exit wrapped as *exec.ExitError. The provider command, not the harness or a timeout, is at fault.

Solutions

  1. Run the provider command manually with the same stdin payload to see its exit status and stderr
  2. Fix the provider script so it exits 0 and emits the protocol response on stdout
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/binding/secret_resolve_exec.go:183 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04). Data as JSON: /api/errors/abd7e516e9a8b3a6. Report an issue: GitHub.

Appendix: source

Thrown at internal/binding/secret_resolve_exec.go:183

//   - empty trimmed stdout → typed error
func runExecCommand(prep *execRun) ([]byte, error) {
	ctx, cancel := context.WithTimeout(context.Background(), prep.Timeout)
	defer cancel()

	cmd := exec.CommandContext(ctx, prep.Path, prep.Args...)
	cmd.Dir = filepath.Dir(prep.Path)
	cmd.Env = prep.Env // always set — leaving nil would inherit the parent env
	cmd.Stdin = bytes.NewReader(prep.Request)

	var stdout, stderr bytes.Buffer
	cmd.Stdout = &stdout
	cmd.Stderr = &stderr

	if err := cmd.Run(); err != nil {
		if ctx.Err() == context.DeadlineExceeded {
			return nil, fmt.Errorf("exec provider timed out after %dms", int(prep.Timeout/time.Millisecond))
		}
		return nil, fmt.Errorf("exec provider exited with error: %w", err)
	}

	if stdout.Len() > prep.MaxOut {
		return nil, fmt.Errorf("exec provider output exceeded maxOutputBytes (%d)", prep.MaxOut)
	}

	trimmed := bytes.TrimSpace(stdout.Bytes())
	if len(trimmed) == 0 {
		return nil, fmt.Errorf("exec provider returned empty stdout")
	}
	return trimmed, nil
}

// extractExecSecret parses stdout as a JSON execResponse and returns the
// string value at refID. When jsonOnly is false and the response is not valid
// JSON (or the value is not a string), it falls back to the raw stdout or the
// JSON encoding of the value respectively — mirroring OpenClaw's resolve.ts.
func extractExecSecret(stdout []byte, refID string, jsonOnly bool) (string, error) {

View on GitHub (pinned to 7fd6ef3c07)