Skip to content

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 CodeLikely CauseSee Section
128Git error: duplicate clone, or clone/checkout failure§2
167Signal 39 (128+39): OOM, cgroup, or bench init failure§3
yarn FileNotFoundErrorNVM not loaded in bench init RUN§4
uv resolver / exit 1prego_saas_app setup.py install_requires frappe§5

2. Exit 128 (Git Error)

2.1 Direct Cause (Duplicate Clone)

  • bench init --apps_path=apps.json clones prego-saas-app (included in apps.json).
  • Subsequent git clone ... apps/prego_saas_app tries 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_TOKEN missing or invalid.
  • Checkout failure: APP_SHA empty or invalid → git checkout fails.

Option A: Remove prego-saas-app from apps.json; install it separately:

  1. apps.json: erpnext, hrms only.
  2. bench init (no prego_saas_app).
  3. git clone prego-saas-app → apps/prego_saas_app.
  4. git checkout ${APP_SHA}.
  5. 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

CauseCheck
APPS_JSON_BASE64Invalid base64, wrong JSON, or inaccessible branch.
Branch mismatchapps.json erpnext/hrms branch must match FRAPPE_BRANCH (e.g. version-15).
Private repo authClone token for prego-saas-app.
Memory (OOM)GitHub runner ~7GB; multi-platform build increases usage.
Node/NVMNVM 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/yarn is only available in a shell that has sourced NVM.
  • bench init RUN uses a non-login shell that does not source NVM → yarn not in PATH.

4.2 Fix (Applied)

  • Before bench init, run: . ${NVM_DIR}/nvm.sh (or source .../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.py has install_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 frappe from install_requires in prego-saas-app setup.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_TOKEN set (if private).
  • NVM sourced before bench init in Dockerfile.
  • apps.json: no duplicate prego-saas-app clone; or use separate install flow.
  • prego-saas-app setup.py: no frappe in install_requires.
  • client_payload.app_sha passed 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 제거.
Help