wxt-dev / wxt-dev/wxt

dist/chrome-mv3/icons/128.png: unable to open for write

Open
#1,839 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pending-triage
Dominant language
TypeScript
Stars
10.5k
Forks
564
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

This only happens in CI but sometimes I get the following error.

 [log] WXT 0.20.7
  [info] Building chrome-mv3 for production with Vite 6.3.5
  - Preparing...
  [fail] Command failed after 31.4 s
  Error:  /home/runner/work/application/application/packages/agent/agent-web-extension/dist/chrome-mv3/icons/128.png: unable to open for write
  unix error: No such file or directory
    at Sharp.toFile (/home/runner/work/application/application/node_modules/.pnpm/sharp@0.33.5/node_modules/sharp/lib/output.js:90:19)
    at /home/runner/work/application/application/node_modules/.pnpm/@wxt-dev+auto-icons@1.0.2_wxt@0.20.7_@types+node@22.17.0_jiti@2.4.2_less@4.1.3_lightnin_c28a655ca60a4242f2b243e857ab8ac5/node_modules/@wxt-dev/auto-icons/dist/index.mjs:47:23
    at /home/runner/work/application/application/node_modules/.pnpm/hookable@5.5.3/node_modules/hookable/dist/index.mjs:48:66
    at /home/runner/work/application/application/node_modules/.pnpm/hookable@5.5.3/node_modules/hookable/dist/index.mjs:48:56

A re-run usually fixes it.

I found this related issue in the Sharp repo: https://github.com/lovell/sharp/issues/1914

I tried to inject a keepfile using a hook but there isn't a hook in the correct place.
I guess it would need to be after cleaning dist dir and before writing to it.

Reproduction

Relevant config:

{
...
  srcDir: 'src',
  outDir: './dist',
  modules: ['@wxt-dev/module-react', '@wxt-dev/auto-icons'],
  autoIcons: {
    grayscaleOnDevelopment: false,
  },
}
Steps to reproduce

As mentioned above happens occasionally in CI, never on my development Mac laptop.

System Info
Github Actions
Used Package Manager

pnpm

Validations

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the @wxt-dev/auto-icons call site shown in the stack trace, including Sharp.toFile, and the build cleanup and output entry points that produce dist/chrome-mv3/icons/128.png. Reproduce the intermittent GitHub Actions failure if possible, then verify that a production Chrome MV3 build consistently writes the icon after the output directory is prepared.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript, vite
Domain
build-system, ci-cd
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.