GraphiteEditor/Graphite · warning

No valid clipboard data

Error message

No valid clipboard data

What it means

navigator.clipboard.read() succeeded but none of the returned ClipboardItems exposed a flavor the editor consumes — no text/plain (used for layer encodings) and no readable image type. Every per-item handler returned false, Promise.any resolved to false, and the function throws; the catch maps this message to a dialog suggesting the standard paste shortcut.

Source

Thrown at frontend/src/utility-functions/clipboard.ts:148

					const blob = await item.getType(imageType);
					const reader = new FileReader();
					reader.onload = async () => {
						if (reader.result instanceof ArrayBuffer) {
							const imageData = await extractPixelData(new Blob([reader.result], { type: imageType }));
							editor.pasteImage(undefined, new Uint8Array(imageData.data), imageData.width, imageData.height);
						}
					};
					reader.readAsArrayBuffer(blob);
					return true;
				}

				// The API limits what kinds of data we can access, so we can get copied images and our text encodings of copied nodes, but not files (like
				// .graphite or even image files). However, the user can paste those with Ctrl+V, which we recommend they in the error message that's shown to them.
				return false;
			}),
		);

		if (!success) throw new Error("No valid clipboard data");
	} catch (err) {
		const unsupported = stripIndents`
			This browser does not support reading from the clipboard.
			Use the standard keyboard shortcut to paste instead.
			`;
		const denied = stripIndents`
			The browser's clipboard permission has been denied.

			Open the browser's website settings (usually accessible
			just left of the URL bar) to allow this permission.
			`;
		const nothing = stripIndents`
			No valid clipboard data was found. You may have better
			success pasting with the standard keyboard shortcut instead.
			`;

		const matchMessage = {
			"clipboard-read": unsupported,

View on GitHub (pinned to c507b35645)

Solutions

  1. Paste with Ctrl+V instead — the paste event can access file data the async API cannot
  2. If the content came from another app, re-copy it as plain text or an image
  3. When writing to the clipboard programmatically (e.g. copied layers), always include a text/plain representation alongside custom flavors
Defensive patterns

Strategy: fallback

Validate before calling

// Probe ClipboardItems for a flavor the editor can consume before processing
const usableTypes = (items: ClipboardItem[]): boolean =>
	items.some((item) => item.types.includes("text/plain") || item.types.some((t) => t.startsWith("image/")));

Try / catch

// Rely on the existing catch mapping: "No valid clipboard data" -> dialog that recommends Ctrl+V
if (!success) throw new Error("No valid clipboard data");

Prevention

When it happens

Trigger: The clipboard holds only flavors the async Clipboard API cannot expose: files copied in the OS file manager (.graphite or image files), private application/x-* types, or rich text (text/html) without a text/plain flavor.

Common situations: Copying a document file in the OS file manager and then using Edit > Paste — the async API cannot expose files, only the paste event can; copying from applications that write only HTML/RTF flavors with no plain-text equivalent.

Related errors


AI-assisted analysis of GraphiteEditor/Graphite@c507b35645 (2026-08-16). Data as JSON: /api/errors/2664e4fcd50878ff. Report an issue: GitHub.