{"record":{"id":"566eb00f04db7d84","repo":"Dokploy/dokploy","slug":"error-deploying-application","errorCode":null,"errorMessage":"Error deploying Application","messagePattern":"Error deploying Application","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"apps/dokploy/pages/api/deploy/[refreshToken].ts","lineNumber":289,"sourceCode":"\n\t\t\tif (IS_CLOUD && application.serverId) {\n\t\t\t\tjobData.serverId = application.serverId;\n\t\t\t\tdeploy(jobData).catch((error) => {\n\t\t\t\t\tconsole.error(\"Background deployment failed:\", error);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tawait myQueue.add(\n\t\t\t\t\t\"deployments\",\n\t\t\t\t\t{ ...jobData },\n\t\t\t\t\t{\n\t\t\t\t\t\tremoveOnComplete: true,\n\t\t\t\t\t\tremoveOnFail: true,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tlogWebhookError(\"Error deploying Application:\", error);\n\t\t\tres.status(400).json({ message: \"Error deploying Application\" });\n\t\t\treturn;\n\t\t}\n\n\t\tres.status(200).json({ message: \"Application deployed successfully\" });\n\t} catch (error) {\n\t\tlogWebhookError(\"Error deploying Application:\", error);\n\t\tres.status(400).json({ message: \"Error deploying Application\" });\n\t}\n}\n\n/**\n * Return the image name without the tag\n * Example: \"my-image\" => \"my-image\"\n * Example: \"my-image:latest\" => \"my-image\"\n * Example: \"my-image:1.0.0\" => \"my-image\"\n * Example: \"myregistryhost:5000/fedora/httpd:version1.0\" => \"myregistryhost:5000/fedora/httpd\"\n * @link https://docs.docker.com/reference/cli/docker/image/tag/\n */","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/Dokploy/dokploy/blob/546686ea3587f12ec5652217dedd9f7960fb6d15/apps/dokploy/pages/api/deploy/[refreshToken].ts#L271-L307","documentation":"Inner catch of the refresh-token deploy handler: an exception occurred while preparing the deployment (parsing commit info, building the queue job, or during the bullmq add). It logs via logWebhookError and responds 400 'Error deploying Application' — a generic wrapper around the real error.","triggerScenarios":"Malformed webhook body (no commit info headers/payload), missing deployment environment/config on the application, or a Redis/queue failure when enqueueing the deploy job.","commonSituations":"CI sends a body the commit-message extractor can't parse; application's build configuration incomplete (no build type/commit SHA); Redis unavailable so the queue add throws.","solutions":["Check the Dokploy server logs for the logWebhookError entry — it contains the underlying error","Send a well-formed payload (e.g. X-GitHub-Event / push body with commits)","Verify the application has a complete deployment configuration","Confirm Redis is up (docker ps) since deployments are enqueued via bullmq"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// before firing webhook, ensure app has a complete deployment config\nconst app = await getApp(id);\nif (!app.buildType || !app.sourceType) throw new Error('Incomplete deployment config');","typeGuard":null,"tryCatchPattern":"const r = await fetch(deployUrl, ...);\nif (r.status === 400) { const logs = await fetchServerLogs(); /* correlate logWebhookError entry */ }","preventionTips":["Monitor server logs for logWebhookError entries when webhooks fail","Keep Redis healthy — deploys depend on the bullmq queue","Send well-formed payloads from CI"],"tags":["webhook","deploy","queue","bullmq","internal-error"],"backgroundTag":"deploy-job-enqueue-failed","analyzedSha":"546686ea3587f12ec5652217dedd9f7960fb6d15","analyzedAt":"2026-08-27T05:18:58.095Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}