yarnpkg/yarn · error · Error

unsure how to copy this: ${src}

Error message

unsure how to copy this: ${src}

What it means

Error "unsure how to copy this: ${src}" thrown in yarnpkg/yarn.

Source

Thrown at src/util/fs.js:318

            if (--remaining === 0) {
              onDone();
            }
          },
          src: path.join(src, file),
        });
      }
    } else if (srcStat.isFile()) {
      onFresh();
      actions.file.push({
        src,
        dest,
        atime: srcStat.atime,
        mtime: srcStat.mtime,
        mode: srcStat.mode,
      });
      onDone();
    } else {
      throw new Error(`unsure how to copy this: ${src}`);
    }
  }
}

async function buildActionsForHardlink(
  queue: CopyQueue,
  events: CopyOptions,
  possibleExtraneous: Set<string>,
  reporter: Reporter,
): Promise<CopyActions> {
  const artifactFiles: Set<string> = new Set(events.artifactFiles || []);
  const files: Set<string> = new Set();

  // initialise events
  for (const item of queue) {
    const onDone = item.onDone || noop;
    item.onDone = () => {
      events.onProgress(item.dest);

View on GitHub (pinned to c2dda503f3)

Solutions

  1. Remove or replace the special file (symlink, socket, FIFO, or device) at the reported path inside the package being copied, then run yarn again.
  2. If the entry is an unexpected symlink in the package cache, run `yarn cache clean` and reinstall.
  3. If the file belongs to a dependency you control, exclude it from the published package (via .npmignore or the files field) so it is not copied during install.

Example fix

rm <socket-or-device-file> && yarn install --force

When it happens

Trigger: Yarn tries to copy a file system entry in src/util/fs.js that is neither a regular file, directory, nor symlink (e.g. a socket, FIFO, or device file).

Common situations: Occurs during package extraction or cache population when a tarball or package directory contains exotic file types Yarn cannot copy.


AI-assisted analysis of yarnpkg/yarn@c2dda503f3 (2026-08-13). Data as JSON: /api/errors/f71234e0e3654964. Report an issue: GitHub.