Dokploy / Dokploy/dokploy

Deployment worker does not reset status to error on failure — services stuck permanently in running state

Open Beginner friendly
#4,083 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
37.4k
Forks
3k
Avg merge
1d 3h
Merged PRs (30d)
73

Description

Description

In apps/dokploy/server/queues/deployments-queue.ts, the BullMQ worker wraps all deployment logic in a try/catch, but the catch block only logs the error and does nothing to recover the service state:

async (job: Job<DeploymentJob>) => {
    try {
        if (job.data.applicationType === "application") {
            await updateApplicationStatus(job.data.applicationId, "running");
            // ... deploy or rebuild
        } else if (job.data.applicationType === "compose") {
            await updateCompose(job.data.composeId, { composeStatus: "running" });
            // ... deploy or rebuild
        }
    } catch (error) {
        console.log("Error", error);  // No status rollback
    }
}

The status is set to "running" at the start. If the deployment throws (network failure, Docker daemon crash, SSH timeout), the status is never reset.

The queue is also configured with removeOnComplete: true and removeOnFail: true, so there is no evidence left for debugging.

Impact

Any deployment that fails inside the worker leaves the service in a ghost "running" state. Users see a perpetual "deploying" indicator with no way to recover short of manually updating the database. Especially dangerous for automated webhook-triggered deployments where nobody is watching the UI.

Fix

Add status rollback in the catch block:

catch (error) {
    console.log("Error", error);
    if (job.data.applicationType === "application") {
        await updateApplicationStatus(job.data.applicationId, "error");
    } else if (job.data.applicationType === "compose") {
        await updateCompose(job.data.composeId, { composeStatus: "error" });
    } else if (job.data.applicationType === "application-preview") {
        await updatePreviewDeployment(job.data.previewDeploymentId, { previewStatus: "error" });
    }
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in apps/dokploy/server/queues/deployments-queue.ts and trace the deployment worker's try/catch and the status helpers it calls. Verify that failed application, compose, and application-preview deployments end in their respective error status rather than remaining running.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, typescript
Domain
backend, devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.