{
  "id": "cloud/gcp-cloud-run-container-startup-probe-failure",
  "signature": "Startup probe failed: HTTP probe failed with statuscode: 503",
  "signature_zh": "启动探测失败：HTTP探测返回状态码：503",
  "regex": "Startup probe failed.*HTTP probe failed with statuscode: 503",
  "domain": "cloud",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Cloud Run's startup probe endpoint is returning a non-2xx status (503) within the initial startup period, often because the application takes longer to initialize than the probe's initialDelaySeconds or periodSeconds allows.",
  "root_cause_type": "generic",
  "root_cause_zh": "Cloud Run的启动探测端点在初始启动期内返回非2xx状态（503），通常是因为应用程序初始化时间超过了探测的initialDelaySeconds或periodSeconds所允许的时间。",
  "versions": [
    {
      "version": "Cloud Run (managed) 2024",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Knative Serving 1.12",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "gcloud CLI 462",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Resource increase may not reduce startup time if the application has a fixed initialization delay (e.g., loading ML models).",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Cloud Run requires a startup probe for long-running services; removing it may cause the container to be killed before it finishes initializing.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Too short a period causes rapid retries that may overwhelm the application during startup, worsening the issue.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Increase startup probe initialDelaySeconds to match application startup time: `gcloud run services update my-service --startup-probe-initial-delay=60 --startup-probe-period=10 --startup-probe-failure-threshold=6`. Also ensure the /health endpoint returns 200 only after full initialization.",
      "success_rate": 0.9,
      "how": "Increase startup probe initialDelaySeconds to match application startup time: `gcloud run services update my-service --startup-probe-initial-delay=60 --startup-probe-period=10 --startup-probe-failure-threshold=6`. Also ensure the /health endpoint returns 200 only after full initialization.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Implement a health check endpoint that returns 503 until the application is ready, then 200. Example in Python Flask: `@app.route('/health') def health(): return ('OK', 200) if app_ready else ('Service Unavailable', 503)`. Set app_ready = True after initialization completes.",
      "success_rate": 0.95,
      "how": "Implement a health check endpoint that returns 503 until the application is ready, then 200. Example in Python Flask: `@app.route('/health') def health(): return ('OK', 200) if app_ready else ('Service Unavailable', 503)`. Set app_ready = True after initialization completes.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Increase startup probe initialDelaySeconds to match application startup time: `gcloud run services update my-service --startup-probe-initial-delay=60 --startup-probe-period=10 --startup-probe-failure-threshold=6`. Also ensure the /health endpoint returns 200 only after full initialization.",
    "Implement a health check endpoint that returns 503 until the application is ready, then 200. Example in Python Flask: `@app.route('/health') def health(): return ('OK', 200) if app_ready else ('Service Unavailable', 503)`. Set app_ready = True after initialization completes."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://cloud.google.com/run/docs/configuring/healthchecks#startup-probes",
  "official_doc_section": null,
  "error_code": "503",
  "verification_tier": "ai_generated",
  "confidence": 0.86,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2024-02-28",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}