Skip to content

Bug: acai push --all crashes with "Invalid string length" on large repos #9

Description

@QT-7274

Summary

acai push --all fails with Invalid string length on repositories containing large
build artifact directories (e.g. Rust target/, Tauri src-tauri/). The CLI scans
these directories for ACID references, building a payload that exceeds V8's max string
length (~512MB).

Environment

  • CLI: @acai.sh/cli@0.0.3 (installed via npm i -g)
  • Node: v22.16.0
  • OS: macOS 14 (Apple Silicon)
  • Server: self-hosted, v0.0.8

Reproduction

  1. Have a repo with a large compiled-output directory not in the current ignore list.
    Example structure:
    my-project/
    ├── features/hello.feature.yaml # minimal valid spec
    ├── src-tauri/ # ~10 GB (Rust target/ etc.)
    ├── crates/ # ~840 MB
    └── ... # 41,000+ files total
  2. Run:
acai push --all
3. Output:
Invalid string length
3. Exit code 1.

Expected

Either:
- Push succeeds, ignoring obviously non-source directories.
- A clear error explaining which directory caused the size blowup, with guidance.

Root cause

In src/core/push.ts, IGNORED_REF_DIRS only excludes:
.git, node_modules, coverage, dist, tmp, .agents, states

Common build-output directories that are not excluded:
- target/ (Rust / Cargo, Java/Maven, Scala/sbt)
- build/ (CMake, Gradle, many others)
- out/ (Next.js, generic)
- .next/, .nuxt/, .svelte-kit/, .turbo/, .cache/
- vendor/ (Go, PHP/Composer)
- __pycache__/, .venv/, venv/, .tox/, .mypy_cache/, .pytest_cache/, .ruff_cache/
- Pods/ (iOS), DerivedData/ (Xcode)
- bin/, obj/ (.NET)
- target/ and src-tauri/target/ are particularly painful because Tauri/Cargo builds
easily produce >5 GB of intermediate files.

When scanning these directories, the resulting payload (file paths + matched ACIDs)
exceeds Node/V8's max string length and JSON.stringify throws Invalid string length.

Proposed fixes

Either or both:

1. Expand the default ignore list in IGNORED_REF_DIRS to cover the common build/cache
directories listed above.

2. Support a .acaiignore file (gitignore-style syntax) at the repo root, so users can
opt-out of directories specific to their stack without waiting for a CLI release.

3. Respect .gitignore by default for the ref scan — if a path is git-ignored, it's

directories listed above.

                                                               2. Support a .acaiignore file (gitignore-style syntax) at the repo root, so users can
opt-out of directories specific to their stack without waiting for a CLI release.

       3. Respect .gitignore by default for the ref scan — if a path is git-ignored, it's
almost never a place where ACID refs should live.

4. Hard limit + actionable error: if the planned payload exceeds N MB or the file count
exceeds M, abort early with a message like:

▎ Scan would include 41,802 files (10.2 GB). Largest directories: src-tauri/ (10 GB),     ▎ crates/ (840 MB). Add them to .acaiignore or extend IGNORED_REF_DIRS.

Workaround

Currently the only workarounds are:
- Run acai push --all only in repos without large build artifacts.
- Manually patch IGNORED_REF_DIRS in node_modules/@acai.sh/cli/dist/... (not portable).

Happy to send a PR for fix #1 (expanded ignore list) or #3 (.gitignore respect) if
maintainers prefer a particular approach.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions