{"record":{"id":"b28027cb08075464","repo":"Dokploy/dokploy","slug":"message","errorCode":null,"errorMessage":"${message}","messagePattern":"\\$\\{message\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/server/src/utils/schedules/utils.ts","lineNumber":94,"sourceCode":"\t\t\tif (!containerId) {\n\t\t\t\tconst target =\n\t\t\t\t\tscheduleType === \"compose\"\n\t\t\t\t\t\t? `service '${serviceName}' of compose '${compose?.name}'`\n\t\t\t\t\t\t: `application '${application?.appName}'`;\n\t\t\t\tconst message = `Container not found for ${target}, make sure the service is running`;\n\t\t\t\tif (serverId) {\n\t\t\t\t\tawait execAsyncRemote(\n\t\t\t\t\t\tserverId,\n\t\t\t\t\t\t`echo ${quote([`❌ ${message}`])} >> ${quote([deployment.logPath])}`,\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tconst writeStream = createWriteStream(deployment.logPath, {\n\t\t\t\t\t\tflags: \"a\",\n\t\t\t\t\t});\n\t\t\t\t\twriteStream.write(`❌ ${message}\\n`);\n\t\t\t\t\twriteStream.end();\n\t\t\t\t}\n\t\t\t\tthrow new Error(message);\n\t\t\t}\n\n\t\t\tif (serverId) {\n\t\t\t\tawait execAsyncRemote(\n\t\t\t\t\tserverId,\n\t\t\t\t\t`\n\t\t\t\t\tset -e\n\t\t\t\t\techo \"Running scheduled command\" >> ${quote([deployment.logPath])};\n\t\t\t\t\tdocker exec ${quote([containerId])} ${quote([shellType])} -c ${quote([command])} >> ${quote([deployment.logPath])} 2>> ${quote([deployment.logPath])} || {\n\t\t\t\t\t\techo \"❌ Command failed\" >> ${quote([deployment.logPath])};\n\t\t\t\t\t\texit 1;\n\t\t\t\t\t}\n\t\t\t\t\techo \"✅ Command executed successfully\" >> ${quote([deployment.logPath])};\n\t\t\t\t\t`,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconst writeStream = createWriteStream(deployment.logPath, {\n\t\t\t\t\tflags: \"a\",","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/Dokploy/dokploy/blob/546686ea3587f12ec5652217dedd9f7960fb6d15/packages/server/src/utils/schedules/utils.ts#L76-L112","documentation":"runCommand in the scheduler executes a shell command (locally or remotely via execAsyncRemote) and throws the combined output as the error message when the command fails; it also appends a ❌ line to the deployment log. The message content is whatever the command printed to stdout/stderr.","triggerScenarios":"Scheduled job's command exits non-zero: missing binary, bad path, failed build/deploy step, or remote server unreachable when serverId is set.","commonSituations":"Cron-style schedule firing after a server rebuild where paths changed; app deploy command failing due to compile errors; remote server offline or SSH connection dropped.","solutions":["Read the full message: it contains the command's stderr explaining the failure","Run the same command manually (or via execAsyncRemote on the target server) to reproduce","Fix the underlying script/binary/path issue the message points to","Verify remote server connectivity and SSH credentials when serverId is involved"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (serverId) {\n  await execAsyncRemote(serverId, 'echo ok'); // connectivity precheck\n}","typeGuard":null,"tryCatchPattern":"try {\n  await runCommand(...);\n} catch (e) {\n  const log = e instanceof Error ? e.message : String(e);\n  // message contains command stderr; run it manually to reproduce\n}","preventionTips":["Pin absolute paths to binaries in scheduled commands","Test scheduled commands manually before enabling the schedule","Monitor remote server availability"],"tags":["scheduler","cron","shell","remote-execution"],"backgroundTag":"command-execution-failed","analyzedSha":"546686ea3587f12ec5652217dedd9f7960fb6d15","analyzedAt":"2026-08-27T05:18:58.095Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}