yamadashy/repomix · warning
wl-copy failed (${msg}); falling back.
Error message
wl-copy failed (${msg}); falling back. What it means
copyToClipboardIfEnabled tries wl-copy (Wayland clipboard) first and logs this warning if spawning/piping to it fails, then falls back to the tinyclipboard library. The copy still succeeds through the fallback; this is a diagnostic only.
Source
Thrown at src/core/packager/copyToClipboardIfEnabled.ts:28
config: RepomixConfigMerged,
): Promise<void> => {
if (!config.output.copyToClipboard) return;
progressCallback('Copying to clipboard...');
if (process.env.NODE_ENV !== 'test' && process.env.WAYLAND_DISPLAY) {
logger.trace('Wayland detected; attempting wl-copy.');
try {
await new Promise<void>((resolve, reject) => {
const proc = spawn('wl-copy', [], { stdio: ['pipe', 'ignore', 'ignore'] });
proc.on('error', (err) => reject(new Error(`Failed to execute wl-copy: ${err.message}`)));
proc.on('close', (code) => (code ? reject(new Error(`wl-copy exited with code ${code}`)) : resolve()));
proc.stdin.end(output);
});
logger.trace('Copied using wl-copy.');
return;
} catch (err: unknown) {
const msg = err instanceof Error ? err.message : 'unknown error';
logger.warn(`wl-copy failed (${msg}); falling back.`);
}
}
try {
logger.trace('Using tinyclip.');
await clipboard.writeText(output);
logger.trace('Copied using tinyclip.');
} catch (err: unknown) {
const msg = err instanceof Error ? err.message : 'unknown error';
logger.error(`tinyclip failed: ${msg}`);
}
};
View on GitHub (pinned to f465ad9093)
Solutions
- Nothing to fix if the fallback works — confirm the output was copied and ignore the warning.
- Install wl-clipboard (e.g. `sudo apt install wl-clipboard`) when on Wayland to use the native path.
- On X11, expect the fallback; optionally unset/inhibit the wl-copy attempt by running in a proper session or configuring the environment.
- Check WAYLAND_DISPLAY / XDG_SESSION_TYPE to confirm which clipboard protocol your session supports.
Example fix
// before: X11 session, wl-copy missing $ repomix --copy // after: install Wayland tooling (Wayland sessions only) $ sudo apt install wl-clipboard && $ repomix --copy
Defensive patterns
Strategy: fallback
Validate before calling
const has = (cmd) => require('child_process').spawnSync(cmd, ['-v'], { stdio: 'ignore' }).status === 0 || require('child_process').spawnSync('which', [cmd]).status === 0;
if (!has('wl-copy')) console.warn('wl-copy unavailable; clipboard lib will be used'); Type guard
const isWayland = () => !!process.env.WAYLAND_DISPLAY;
Try / catch
try { await copyToClipboardIfEnabled(output, config); } catch (e) { logger.warn(`clipboard copy failed: ${e.message}`); } Prevention
- Install wl-clipboard on Wayland sessions; rely on the built-in fallback elsewhere.
- Verify WAYLAND_DISPLAY/XDG_SESSION_TYPE match the installed clipboard tooling.
- Treat the warning as informational when --copy output lands successfully.
When it happens
Trigger: Spawning wl-copy rejects: wl-clipboard not installed, running under X11 with no Wayland compositor/socket (WAYLAND_DISPLAY unset), wl-copy exiting nonzero, or stdin.write/EPIPE errors.
Common situations: Users on X11 or macOS sessions where wl-copy is missing or useless; minimal containers/CI without a clipboard; wl-clipboard version changes breaking the CLI args.
Related errors
- Failed to compress ${rawFile.path}, using uncompressed conte
- Failed to compress ${filePath}, using uncompressed content:
- File processor for "${rawFile.path}" failed, using original
AI-assisted analysis of yamadashy/repomix@f465ad9093 (2026-08-29).
Data as JSON: /api/errors/7d2aebfbef74de5b.
Report an issue: GitHub.