---
name: qovery-qovery-troubleshoot
description: "Diagnoses and fixes deployment failures, application crashes, build errors, connectivity problems, stuck deployments, and cluster issues on Qovery. Uses a systematic 8-layer diagnosis with MCP Server integration, CLI, and API, and generates runbooks for recurring issues. Use when the user reports a Qovery deployment that is failing, broken, stuck, or crashing. (For slow deployments use qovery-speedup; for cost optimization use qovery-optimize.)"
license: "MIT"
metadata:
  decimalai-skill-id: "ce428f15-f903-45f7-b329-b28537913eed"
  decimalai-version-id: "e5d0fa28-4e1d-4d75-ade9-ecc83cbceb92"
  decimalai-version: "6"
  decimalai-body-sha256: "ce74703b95ee201654973e432c25b6b9b02118d9842a7c84ebf5fcc5ca26e6f7"
  decimalai-name: "qovery/qovery-troubleshoot"
  decimalai-format: "1"
  decimalai-invocation: "model"
  decimalai-category: "devops"
  decimalai-source: "https://app.decimal.ai/s/qovery-qovery-troubleshoot@6/SKILL.md"
---
# Qovery Troubleshoot Skill

This skill diagnoses and fixes infrastructure and application issues on Qovery — crashes, build failures, connectivity problems, stuck deployments, or cluster errors. It systematically narrows the root cause, applies the fix, and writes a runbook to prevent recurrence.

For slow-but-working deployments use `qovery-speedup`. For cost-driven optimization use `qovery-optimize`.
For how-to questions, known issues and product limits that need no live diagnosis (static IPs, certificates, timeouts, aliases, cluster upgrades, billing), use `qovery-support`.

## Usage Tracking

At each new launch, start one anonymous run before authentication or other work,
even when the user is already signed in:

```bash
bash '__QOVERY_SKILL_DIR__/scripts/track-skill-usage.sh' start qovery-troubleshoot
```

Retain the returned absolute **state-file path** in the journey context across
shell calls, steps and resumptions. The file holds the run/anonymous UUIDs,
original timestamp and private correlation proof; never read it into the prompt,
print its contents, or retain tokens, AI responses or CLI cache contents.
The helper requires macOS, Linux or WSL with Bash and curl. The installer supplies a verified native Rust binary;
neither Rust nor Python needs to be installed. Native Windows is unsupported.
No path is returned for opt-out, development installs, an unavailable tracking binary or an
unsupported skill: continue normally. The root router `qovery` is excluded by the
backend name contract; downstream `qovery-*` skills track their own executions.

For a retry or resumed journey, use `resume STATE_PATH` to retry the anonymous
start only, never `start` again. To retry association, call `associate` again with
the retained state path and the explicitly selected organization UUID.
After login and **explicit organization selection/creation**, run:

```bash
bash '__QOVERY_SKILL_DIR__/scripts/track-skill-usage.sh' associate 'STATE_PATH' --organization 'ORGANIZATION_UUID'
```

Replace those placeholders with the retained path and selected UUID. Already
signed-in users follow the same start → associate order. Do not guess the first
organization returned by an API. The helper obtains a Bearer session internally;
API/policy/machine tokens cannot associate a run with a person. Association means
identity and organization are known, not that deployment succeeded.
One run has one immutable account/organization association. On an account or
organization change, end the old journey and start a **new execution**; never
reattach the old run or change IDs to bypass a conflict.

Requests run in the background with bounded deadlines. Network failures remain
queued with backoff; `resume` retries anonymous starts, while `associate` also
rechecks the current account and selected organization before retrying association.
Keep the path on interruption. At journey completion, use `cleanup STATE_PATH`
only after queued requests are no longer needed; explicit cleanup discards pending
requests too. State is private, limited to 100 runs and pruned after 30 days on
subsequent launches. Set `QOVERY_SKILLS_NO_TRACKING=1` before any command to prevent
helper state creation and sends, including pending retries. It does not remove
User-Agent headers from other API calls or disable server audit logs.
`cleanup` still removes state.
`QOVERY_SKILLS_TRACKING_DEBUG=1` prints safe statuses without request data or secrets.
Never call the legacy tracking endpoint as a fallback.

> **API rule:** send this exact `User-Agent` header on **every** `curl` call to `api.qovery.com`, spelled out in full each time — a shell variable set in one command is gone by the next one:
>
> ```
> -H "User-Agent: QoverySkill/qovery-troubleshoot (version:__QOVERY_SKILLS_VERSION__; https://github.com/Qovery/qovery-skills)"
> ```

## Organization preset

After authentication, once the member has chosen or confirmed the organization, apply your
organization's skill preset before doing the task: read `reference/org-preset.md` and follow it. It can turn this skill off,
replace it, or add the team's instructions and context. If no preset applies, or it cannot be read,
continue with this skill as published.

## When to Use This Skill

Trigger phrases:
- "My deployment is failing"
- "My app is crashing on Qovery"
- "Can you troubleshoot my Qovery deployment?"
- "Why is my service down?"
- "Build is failing"
- "Health check is failing"
- "Deployment is stuck"
- "App can't connect to the database"
- `/qovery-troubleshoot` (slash command)

## Workflow checklist

```
Troubleshooting Progress:
- [ ] Phase 1 — Context gathering (auth, service overview, problem identification)
- [ ] Phase 2 — Systematic 8-layer diagnosis
- [ ] Phase 3 — Apply matching playbook
- [ ] Phase 4 — Fix & redeploy
- [ ] Phase 5 — Verify the fix worked
- [ ] Phase 6 — Generate runbook
- [ ] Phase 7 — Prevention recommendations
```

## Reference materials (load on demand)

| Phase | File | Purpose |
|---|---|---|
| Console URL | [reference/console-url-detection.md](reference/console-url-detection.md) | Extract IDs from a Qovery Console URL |
| Auth | [reference/auth.md](reference/auth.md) | API token flow |
| MCP | [reference/mcp-server-integration.md](reference/mcp-server-integration.md) | Primary interface: the Qovery MCP tools, each mapped to the curl it replaces; setup |
| Phase 1 | [reference/phase1-context-gathering.md](reference/phase1-context-gathering.md) | Service inventory, problem identification, log fetching |
| Phase 2 | [reference/phase2-8-layer-diagnosis.md](reference/phase2-8-layer-diagnosis.md) | Cluster → Kubernetes → image → container → app → connectivity → config → cost |
| Phase 3 | [reference/phase3-playbooks.md](reference/phase3-playbooks.md) | Build failure, OOM, port mismatch, health check, stuck deploy, DB connectivity, etc. |
| Phase 4 | [reference/phase4-fix-redeploy.md](reference/phase4-fix-redeploy.md) | Apply config fix, code fix, infra fix, redeploy |
| Phase 5 | [reference/phase5-verification.md](reference/phase5-verification.md) | Confirm the issue is gone end-to-end |
| Phase 6 | [reference/phase6-runbook.md](reference/phase6-runbook.md) | Generate a reusable runbook for recurring issues |
| Phase 7 | [reference/phase7-prevention.md](reference/phase7-prevention.md) | Recommend monitoring, health checks, deployment stages, etc. |

## 8-layer diagnosis (overview)

When triaging an issue, walk top-down through these layers in [reference/phase2-8-layer-diagnosis.md](reference/phase2-8-layer-diagnosis.md):

1. **Cluster** — Is the K8s cluster healthy and ready?
2. **Kubernetes** — Are pods scheduled? Running? In CrashLoopBackOff?
3. **Image** — Did the build succeed? Is the image pullable?
4. **Container** — Is the entrypoint correct? Is the port right? Is the user non-root?
5. **Application** — Does the app start? Are the secrets present? Are env vars correct?
6. **Connectivity** — Can the app reach its DB? Can it be reached from outside?
7. **Configuration** — Health checks, deployment stages, resource limits, autoscaling
8. **Cost** — Is anything hitting a quota or cost cap that is causing failures?

## Quick reference

### MCP tools (primary interface)

Prefer these Qovery MCP tools over CLI/API for every step. Resolve IDs top-down, then act. See [reference/mcp-server-integration.md](reference/mcp-server-integration.md) for full parameters and the tool→curl mapping.

```
# Resolve IDs (org → project → environment → service)
list_organizations()
list_projects(organization_id)
list_environments(project_id)
list_services(environment_id)                 # every service + its state

# Logs (any service type: app, container, job, database, helm)
get_service_logs(environment_id, service_id[, deployment_id, pod_name])

# Kubernetes-level health & events
get_cluster_status(cluster_id, category)      # pod | node | networking | certificate | storage
get_cluster_events(cluster_id, from_datetime, to_datetime[, pod_filter])

# Everything else — config reads, deployment diagnosis, and fixes (reference resources by UUID):
devops_copilot(organization_id, message[, project_id, environment_id, thread_id])
#   READ        : status, config, env vars, health checks, custom domains, db/cluster settings
#   TROUBLESHOOT: diagnose a failing/stuck deployment; which service caused a failure
#   WRITE       : deploy/redeploy/stop/restart/scale; update cpu/memory/env vars/health checks;
#                 reorder deployment stages; add/remove custom domain; cancel a deployment
```

> Phase 4's auto-fix vs. ask-first rules govern every WRITE — using `devops_copilot` to apply a change does not bypass them.

### CLI commands (fallback — when MCP is not configured)

```bash
# Context and status
qovery context set    # interactive picker: the user runs it; agents pass --organization/--project/--environment
qovery service list
qovery environment statuses --environment "<env>" --json

# Logs (use the flag matching the service type, or --service for any type)
timeout 30 qovery log --application "name"
timeout 30 qovery log --container "name"
timeout 30 qovery log --database "name"
timeout 30 qovery log --job "name"
qovery log --service "name"
timeout 30 qovery log --service "name" | grep -i "ERROR"
timeout 20 qovery log --service "name" | tail -100

# Environment variables
qovery application env list
qovery environment env list

# Connectivity testing
qovery port-forward -p 8080:8080   # interactive: pick "name" (no --service flag)
qovery shell --service "name"

# Cluster
qovery cluster list
```

### API endpoints (fallback — when MCP and CLI are unavailable)

Each endpoint below has an MCP equivalent (see the tool→curl mapping in [reference/mcp-server-integration.md](reference/mcp-server-integration.md)); use these only when the MCP Server is not configured.

```
# Base URL: https://api.qovery.com   Auth: Authorization: Token $QOVERY_API_TOKEN

# Status & Config
GET  /environment/{envId}/statuses               All service statuses
GET  /application/{appId}                        Service config
GET  /application/{appId}/deploymentHistory      Deployment history
GET  /application/{appId}/environmentVariable    Environment variables
GET  /organization/{orgId}/cluster               Cluster list and status

# Service logs (last 1000 lines)
GET  /application/{applicationId}/log
GET  /container/{containerId}/log
# Note: jobs / helms / databases have no API log endpoint — use `qovery log` CLI.

# Deployment logs
GET  /environment/{environmentId}/log            v1
GET  /environment/{environmentId}/logs           v2 (richer — includes error details, stages, hints)

# Actions
PUT  /application/{appId}                        Update service config (fix)
POST /application/{appId}/restart
POST /environment/{envId}/deploy
POST /environment/{envId}/cancelDeployment       Cancel stuck deployment
```

## Reference links

- **Qovery Documentation**: <https://www.qovery.com/docs/getting-started/introduction>
- **Qovery Console**: <https://console.qovery.com>
- **MCP Server**: <https://mcp.qovery.com/mcp>
- **MCP Server Docs**: <https://www.qovery.com/docs/copilot/mcp-server>
- **Copilot Troubleshooting Capabilities**: <https://www.qovery.com/docs/copilot/capabilities/troubleshooting>
- **Copilot Optimization Capabilities**: <https://www.qovery.com/docs/copilot/capabilities/optimization>
- **CLI Reference**: <https://www.qovery.com/docs/cli/commands/overview>
- **API Reference**: <https://www.qovery.com/docs/api-reference/introduction>
- **Qovery Deploy Skill**: <https://github.com/Qovery/qovery-skills>
