larksuite/cli · error

exec provider returned empty stdout

Error message

exec provider returned empty stdout

What it means

Fails when the exec secret provider exits successfully but its stdout is empty after trimming whitespace. The exec protocol requires the provider to print a JSON execResponse (or at least a raw secret) on stdout; empty output means the provider produced nothing resolvable.

Source

Thrown at internal/binding/secret_resolve_exec.go:192

	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) {
	var resp execResponse
	if err := json.Unmarshal(stdout, &resp); err != nil {
		if !jsonOnly {
			return string(stdout), nil
		}
		return "", fmt.Errorf("exec provider returned invalid JSON: %w", err)
	}

	if resp.ProtocolVersion != 1 {

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Fix the provider to write the secret or the JSON execResponse to stdout instead of stderr or nowhere
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/binding/secret_resolve_exec.go:192 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/02774ad50b1d013d. Report an issue: GitHub.