{"record":{"id":"38e4d261fc843cf0","repo":"microsoft/aspire","slug":"application-orchestrator-dependency-check-returned-an-error","errorCode":null,"errorMessage":"Application orchestrator dependency check returned an error: 'dcp {arguments}' returned exit code {exitCode}. {stderr}{newline}{stdout}","messagePattern":"Application orchestrator dependency check returned an error: 'dcp (.+?)' returned exit code (.+?)\\. (.+?)(.+?)(.+?)","errorType":"exception","errorClass":"DistributedApplicationException","httpStatus":null,"severity":"critical","filePath":"src/Aspire.Hosting/Dcp/DcpDependencyCheck.cs","lineNumber":88,"sourceCode":"                    ThrowOnNonZeroReturnCode = false\n                };\n\n                (task, processDisposable) = ProcessUtil.Run(processSpec);\n                ProcessResult processResult;\n\n                // Disable timeout if DependencyCheckTimeout is set to zero or a negative value\n                if (_dcpOptions.DependencyCheckTimeout > 0)\n                {\n                    processResult = await task.WaitAsync(TimeSpan.FromSeconds(_dcpOptions.DependencyCheckTimeout), cancellationToken).ConfigureAwait(false);\n                }\n                else\n                {\n                    processResult = await task.WaitAsync(cancellationToken).ConfigureAwait(false);\n                }\n\n                if (processResult.ExitCode != 0)\n                {\n                    throw new DistributedApplicationException(string.Format(\n                        CultureInfo.InvariantCulture,\n                        MessageStrings.DcpDependencyCheckFailedMessage,\n                        $\"'dcp {arguments}' returned exit code {processResult.ExitCode}. {errorStringBuilder.ToString()}{Environment.NewLine}{outputStringBuilder.ToString()}\"\n                    ));\n                }\n\n                // Parse the output as JSON\n                var output = outputStringBuilder.ToString();\n                if (output == string.Empty)\n                {\n                    return null; // Best effort\n                }\n\n                var dcpInfo = JsonSerializer.Deserialize<DcpInfo>(output);\n                if (dcpInfo == null)\n                {\n                    return null; // Best effort\n                }","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting/Dcp/DcpDependencyCheck.cs#L70-L106","documentation":"GetDcpInfoAsync runs the dcp binary (e.g. 'dcp info') and if it exits non-zero the error output is wrapped in a DistributedApplicationException using the DcpDependencyCheckFailedMessage template. It means the DCP process itself ran but reported failure.","triggerScenarios":"'dcp <arguments>' (dependency/version info command) completes with ExitCode != 0 while collecting dcp info in GetDcpInfoAsync.","commonSituations":"Corrupted or incompatible dcp binary, missing runtime prerequisites on the machine, malformed dcp home/state directories, or a dcp version whose CLI arguments changed.","solutions":["Read the captured stderr/stdout in the exception message to see dcp's own error and address it.","Delete stale DCP state/cache directories and let Aspire regenerate them.","Reinstall or update the Aspire CLI/hosting packages so the dcp binary version matches the SDK.","Ensure required OS prerequisites (correct OS/arch build of dcp) are installed."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"var probe = await ProcessX.StartAsync(\"dcp info\"); // or run 'dcp --version' yourself; check exit code and stderr before starting the AppHost","typeGuard":null,"tryCatchPattern":"try\n{\n    var info = await dcpDependencyCheck.GetDcpInfoAsync(ct);\n}\ncatch (DistributedApplicationException ex)\n{\n    logger.LogError(ex, \"dcp dependency check failed: {Details}\", ex.Message); // message embeds dcp stderr/stdout\n}","preventionTips":["Keep the dcp binary and Aspire.Hosting packages on matching versions.","Periodically delete stale DCP state/cache directories.","Run 'dcp info' manually to validate the install after upgrades.","Don't wrap the dcp binary with scripts that alter its exit codes or output."],"tags":["dcp","process-exit-code","orchestration"],"backgroundTag":"cli-command-failed","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}