kovidgoyal/kitty · error

EPERM

EPERM

Error message

permission denied

What it means

The remote clipboard peer returned status EPERM, mapped to 'permission denied'. The user denied or is not permitted to perform the clipboard operation — typically because the confirmation dialog (enabled via password/confirm settings) was rejected.

Source

Thrown at kittens/clipboard/read.go:240

	}
	if len(payload) > 0 {
		ans.WriteString(";")
		ans.WriteString(enc_payload)
	}
	ans.WriteString("\x1b\\")
	return ans.String()
}

func encode(metadata map[string]string, payload string) string {
	return Encode_bytes(metadata, utils.UnsafeStringToBytes(payload))
}

func error_from_status(status string) error {
	switch status {
	case "ENOSYS":
		return fmt.Errorf("no primary selection available on this system")
	case "EPERM":
		return fmt.Errorf("permission denied")
	case "EBUSY":
		return fmt.Errorf("a temporary error occurred, try again later.")
	default:
		return fmt.Errorf("%s", status)
	}
}

func parse_escape_code(etype loop.EscapeCodeType, data []byte) (metadata map[string]string, payload []byte, err error) {
	if etype != loop.OSC || !bytes.HasPrefix(data, utils.UnsafeStringToBytes(OSC_NUMBER+";")) {
		return
	}
	parts := bytes.SplitN(data, utils.UnsafeStringToBytes(";"), 3)
	metadata = make(map[string]string)
	if len(parts) > 2 && len(parts[2]) > 0 {
		payload, err = base64.StdEncoding.DecodeString(utils.UnsafeBytesToString(parts[2]))
		if err != nil {
			err = fmt.Errorf("Received OSC %s packet from terminal with invalid base64 encoded payload", OSC_NUMBER)
			return

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Approve the confirmation prompt or supply the correct --password for the read
  2. Loosen kitty.conf clipboard_control if interactive confirmation is unwanted (e.g. allow read-clipboard without confirm)
  3. Grant clipboard permissions to the sandboxed app or run outside the sandbox
  4. For scripts, use --password with --human-name so authorization succeeds non-interactively

Example fix

# before
kitten clipboard get out.txt   # user denies prompt -> EPERM
# after
kitten clipboard get --human-name my-script --password text:pw out.txt
Defensive patterns

Strategy: retry

Validate before calling

null

Try / catch

for i in 1 2 3; do kitten clipboard get f && break; sleep 1; done  # re-prompt user

Prevention

When it happens

Trigger: Requesting clipboard data when a password/confirmation is configured and the user cancels or enters the wrong password, so the answering side replies EPERM; sandboxed environments (snap/flatpak) blocking clipboard access also produce this.

Common situations: kitty's clipboard_control settings requiring confirmation for reads; clicking 'No' on the allow dialog; sandboxed apps lacking clipboard permissions; headless contexts where nobody can approve the prompt.

Understand the failure class

Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.

Related errors


AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27). Data as JSON: /api/errors/8f74202765648ab6. Report an issue: GitHub.