figma plugin PostToolUse hook causes 'failed to write hook stdin: Broken pipe (os error 32)' on every Write/Edit

Open 💬 0 comments Opened Jul 13, 2026 by gn00295120

Summary

With the curated figma plugin enabled, every file Write/Edit in a Codex session surfaces:

• PostToolUse hook (failed)
  error: failed to write hook stdin: Broken pipe (os error 32)

Reproduced on codex-cli 0.144.1 (macOS, plugin figma@openai-curated-remote 2.0.14).

Root cause

The plugin's hook (source: openai/pluginsplugins/figma/hooks.json) registers scripts/post_write_figma_parity_check.sh on PostToolUse with matcher Write|Edit. The script prints a single nudge line and exits without ever reading stdin:

#!/usr/bin/env bash
set -euo pipefail
echo "[draft-hook] PostToolUse triggered after file write. ..."

Codex writes the PostToolUse event JSON to the hook's stdin. For a script this short, the process usually exits before that write lands, so the write hits a closed pipe → EPIPE, and the CLI reports the hook as failed on essentially every edit.

Repro

# writer gets SIGPIPE — same failure mode the CLI reports
(sleep 0.3; printf '{"tool_name":"Edit"}') | ./plugins/figma/scripts/post_write_figma_parity_check.sh

Suggested fixes

1. Plugin-side (one line). Drain stdin before exiting when it is not a TTY:

[ -t 0 ] || cat >/dev/null 2>&1 || true

Ready-to-apply patch: https://github.com/gn00295120/plugins/commit/360d10ec (branch fix/figma-hook-drain-stdin; I could not open a PR against openai/plugins — external PRs appear restricted and its issues are disabled, hence filing here).

2. Runner-side (defense in depth). Consider treating EPIPE on the hook-stdin write as benign when the hook process exits 0 — a hook that legitimately ignores its payload shouldn't be reported as failed. That would harden Codex against the same bug in any third-party hook.

View original on GitHub ↗