Repository navigation
Description
Bug Description
Running specify extension add <id> --from <url> inside a project located on a fuse.gocryptfs mount fails immediately after downloading the archive with Error: Could not safely write download file: [Errno 2] No such file or directory.
In src/specify_cli/extensions/_commands.py, install_extension_from_url() creates a temp archive file in .specify/extensions/.cache/downloads/ via _open_download_zip_via_dir_fd(), which immediately calls os.unlink() while keeping the file descriptor open, and then calls download_file.write(archive_data) and download_file.flush(). On gocryptfs (FUSE), flushing writes to an already-unlinked open file descriptor fails with ENOENT.
Steps to Reproduce
- Mount a
gocryptfsencrypted directory (e.g.,gocryptfs 2.4.0on WSL2 Ubuntu 24.04 withrw,nosuid,nodev,relatime,sync,dirsync,user_id=1000,group_id=1000,default_permissions,allow_other). - Inside the mounted directory, initialize a Spec Kit project:
specify init my-project cd my-project - Install any extension from a URL:
specify extension add multirepo --from \ https://github.com/joaopaschuino/speckit-multirepo/archive/refs/tags/v1.0.0.zip
- Confirm the untrusted source prompt (
y).
Minimal Python reproducer demonstrating the underlying filesystem behavior inside the same directory:
import os
path = f".unlinked-write-test-{os.getpid()}"
fd = os.open(path, os.O_RDWR | os.O_CREAT | os.O_EXCL, 0o600)
os.unlink(path)
with os.fdopen(fd, "w+b") as f:
f.write(b"hello world")
f.flush() # -> FileNotFoundError: [Errno 2] No such file or directoryExpected Behavior
The extension archive is downloaded and installed cleanly into .specify/extensions/ without failing on filesystems that don't support flushing to an already-unlinked open file descriptor.
Actual Behavior
After confirming the untrusted source prompt and downloading the archive, the CLI aborts with:
Error: Could not safely write download file: [Errno 2] No such file or directory
Specify CLI Version
1.4.4
AI Agent
Not applicable
Operating System
Ubuntu 24.04.5 LTS on WSL2 (Linux 6.18.33.2-microsoft-standard-WSL2 x86_64, WSL 2.7.12.0, Windows 10.0.26300.9974)
Python Version
3.12.3
Error Logs
❯ specify extension add multirepo --from \
https://github.com/joaopaschuino/speckit-multirepo/archive/refs/tags/v1.0.0.zip
╭────────────────────────────────────────────────────────────────── ⚠ Untrusted Source ──────────────────────────────────────────────────────────────────╮
│ │
│ You are installing an extension directly from an external URL, │
│ bypassing your trusted (install-allowed) extension catalogs. │
│ │
│ URL: https://github.com/joaopaschuino/speckit-multirepo/archive/refs/tags/v1.0.0.zip │
│ │
│ Only install extensions from sources you trust. │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Continue with installation? [y/N]: y
Downloading from https://github.com/joaopaschuino/speckit-multirepo/archive/refs/tags/v1.0.0.zip...
Error: Could not safely write download file: [Errno 2] No such file or directory
Minimal Python reproducer output:
FileNotFoundError: [Errno 2] No such file or directory
(raised on `f.flush()`, and again on `close()` when exiting the `with` block).Additional Context
- Filesystem details:
gocryptfs 2.4.0; go-fuse 2.4.2; 2025-06-24 go1.22.2 linux/amd64- Mount type/options:
fuse.gocr(fs_type=fuseblk,block_size=4096),rw,nosuid,nodev,relatime,sync,dirsync,user_id=1000,group_id=1000,default_permissions,allow_other - Backing ciphertext directory lives on WSL2's internal
/home/...ext4 filesystem (not/mnt/c/...).
- Suggested fix: Since
install_extension_from_url()already buffers the full archive in memory (archive_data = read_response_limited(...), bounded to 50 MiB), it could either passio.BytesIO(archive_data)directly todetect_archive_format()andmanager.install_from_zip(..., archive_file=...)(avoiding a temp file on the project filesystem altogether), or unlink the temp file infinally:after closing instead of unlinking before writing. - Workaround: Cloning the extension locally and installing via
specify extension add <local-dir> --devbypasses the URL downloader and succeeds.
AI Disclosure
- Agent / Tool: T3 Code (Antigravity harness)
- Model & Settings: Gemini 4 Neon (reasoning effort: High), human-supervised interactive session
- Extent: I reproduced the error and ran all local diagnostics/reproducer commands manually; the AI inspected
src/specify_cli/extensions/_commands.pyto identify the root cause, wrote the minimal Python reproducer script, and drafted the text of this issue report.
Activity