prego-docker Build Troubleshooting
Purpose: Consolidated guide for prego-docker build failures (exit 128, 167, yarn not found, uv resolver).
flowchart LR
APP[prego-saas-app push] --> ND[notify-image-rebuild]
ND -->|repository_dispatch| GH[GitHub Actions]
GH --> B[build-and-push]
B --> D[Dockerfile]
D --> BI[bench init]
BI --> NVM{nvm loaded?}
NVM -->|no| YARN["yarn not found"]
NVM -->|yes| UV{uv resolver}
UV -->|frappe in install_requires| UV_FAIL[exit 1]
UV -->|ok| CLONE{duplicate clone?}
CLONE -->|yes| EX128[exit 128]
CLONE -->|no| PUSH[push image]
Source: Merged from prego-docker-exit-128-*, prego-docker-build-exit-167-analysis, prego-docker-build-yarn-not-found-analysis, prego-docker-bench-init-uv-resolver-resolution-plan.
1. Quick Reference
| Exit Code | Likely Cause | See Section |
|---|---|---|
| 128 | Git error: duplicate clone, or clone/checkout failure | §2 |
| 167 | Signal 39 (128+39): OOM, cgroup, or bench init failure | §3 |
| yarn FileNotFoundError | NVM not loaded in bench init RUN | §4 |
| uv resolver / exit 1 | prego_saas_app setup.py install_requires frappe | §5 |
2. Exit 128 (Git Error)
2.1 Direct Cause (Duplicate Clone)
bench init --apps_path=apps.jsonclones prego-saas-app (included in apps.json).- Subsequent
git clone ... apps/prego_saas_apptries to clone into an existing directory. - Result:
fatal: destination path 'apps/prego_saas_app' already exists→ exit 128.
2.2 Other Causes
- Clone failure: Private repo +
PREGO_SAAS_APP_CLONE_TOKENmissing or invalid. - Checkout failure:
APP_SHAempty or invalid →git checkoutfails.
2.3 Resolution (Recommended)
Option A: Remove prego-saas-app from apps.json; install it separately:
- apps.json: erpnext, hrms only.
- bench init (no prego_saas_app).
git cloneprego-saas-app →apps/prego_saas_app.git checkout ${APP_SHA}.bench pip install -e apps/prego_saas_app.
Option B: Ensure PREGO_SAAS_APP_CLONE_TOKEN is set (private repo). Verify client_payload.app_sha in repository_dispatch.
3. Exit 167 (Signal 39 / Resource)
3.1 Meaning
- 167 = 128 + 39 → Process terminated by signal 39.
- Often indicates OOM, cgroup limits, or timeout.
3.2 Likely Causes
| Cause | Check |
|---|---|
| APPS_JSON_BASE64 | Invalid base64, wrong JSON, or inaccessible branch. |
| Branch mismatch | apps.json erpnext/hrms branch must match FRAPPE_BRANCH (e.g. version-15). |
| Private repo auth | Clone token for prego-saas-app. |
| Memory (OOM) | GitHub runner ~7GB; multi-platform build increases usage. |
| Node/NVM | NVM not loaded in bench init shell. |
3.3 Mitigations
- Use single-platform build first for testing.
- Reduce BuildKit parallelism.
- Ensure NVM is sourced before
bench init(see §4).
4. FileNotFoundError: ‘yarn’
4.1 Cause
- NVM-installed
node/yarnis only available in a shell that has sourced NVM. bench initRUN uses a non-login shell that does not source NVM →yarnnot in PATH.
4.2 Fix (Applied)
- Before
bench init, run:. ${NVM_DIR}/nvm.sh(orsource .../nvm.sh). - Use
SHELL ["/bin/bash", "-c"]so the same shell runs both source and bench init.
5. uv Resolver / bench init Exit 1
5.1 Cause
prego_saas_app/setup.pyhasinstall_requires=["frappe>=15.0.0", ...].- Frappe is not on PyPI; uv cannot resolve it → dependency resolution fails → exit 1.
5.2 Fix
- Fix 1 (Immediate): Remove
frappefrominstall_requiresin prego-saas-appsetup.py.- Frappe is already installed by bench; declaring it causes uv to fail.
- Fix 2: Ensure prego-saas-app is installed after checkout APP_SHA: clone → checkout → install.
6. Verification Checklist
-
PREGO_SAAS_APP_CLONE_TOKENset (if private). - NVM sourced before
bench initin Dockerfile. - apps.json: no duplicate prego-saas-app clone; or use separate install flow.
- prego-saas-app
setup.py: nofrappeininstall_requires. -
client_payload.app_shapassed correctly from notify workflow.
References
한국어
prego-docker 빌드 트러블슈팅
목적: prego-docker 빌드 실패(exit 128, 167, yarn 없음, uv resolver) 통합 가이드.
요약
- §1 퀵 레퍼런스: 128(Git·중복 clone), 167(OOM·시그널 39), yarn(Файл не найден), uv(setup.py frappe 제거).
- §2 Exit 128: bench init이 prego_saas_app을 clone한 뒤 다시 git clone 시도 → 중복. apps.json에서 prego-saas-app 제거 후 별도 clone·checkout·install.
- §3 Exit 167: OOM, APPS_JSON 오류, branch 불일치. 단일 플랫폼·NVM source로 완화.
- §4 yarn: bench init RUN에서 NVM 미로딩 →
. ${NVM_DIR}/nvm.sh후 bench init. - §5 uv resolver: prego_saas_app setup.py에서 frappe 제거.