Skip to content

Troubleshooting ​

Errors you may meet while following the guide, what they mean and how to fix them. Most of them were hit while building it.

Error or symptomWhat it meansFix
Npgsql.PostgresException: 28000: role "postgres" does not existThe app reached a different PostgreSQL, usually one installed on your machine on port 5432.The compose file publishes the container on port 5433. Check the connection string uses Port=5433.
fail: Microsoft.EntityFrameworkCore.Database.Command for SELECT ... FROM "__EFMigrationsHistory" on first startEF Core checks for the history table before creating it.Nothing: the next line is Applying migration .... It only happens on an empty database.
InvalidOperationException: Connection string 'Orders' is missing.The app is not running in Development, so appsettings.Development.json is not loaded.Use the launch profile (dotnet run --project src/Orders.Api) or set ASPNETCORE_ENVIRONMENT=Development (worker: DOTNET_ENVIRONMENT).
OptionsValidationException: The UserName field is required. at startupRabbitMQ credentials are missing; ValidateOnStart stops the app early on purpose.Same as above for local runs; on a server, set RabbitMq__UserName and RabbitMq__Password from a secret store.
error NU1008: ... cannot define a value for VersionCentral package management is on; the template wrote a version in the .csproj.Remove Version from the PackageReference and add a PackageVersion in Directory.Packages.props.
ValidateDataAnnotations not found in the workerWorker projects do not include the ASP.NET Core shared framework.Add Microsoft.Extensions.Options.DataAnnotations.
API log: PublishReturnException: 312 NO_ROUTEThe publish used mandatory: true and no queue is bound to the routing key.Start the worker (it declares and binds its queue), or bind a queue yourself. The row stays in the outbox until then.
PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-exchange' when the worker startsThe queue exists with older arguments; arguments cannot change.Stop the worker, docker compose exec rabbitmq rabbitmqctl delete_queue shipping.order-placed, start it again. In production, use a policy.
A failing message is redelivered forever, x-delivery-count never growsSince RabbitMQ 4.3, basic.nack with requeue: true does not count towards a quorum queue's delivery limit.Use BasicRejectAsync(tag, requeue: true) (step 07).
Management API: Feature transient_nonexcl_queues is deprecatedRabbitMQ 4.x refuses non-durable, non-exclusive queues.Create test queues with {"durable":true}.
Endpoint is unsecured banner in the Aspire dashboardThe compose file turns off the dashboard login for local use.Expected locally. Never expose the dashboard like this on a server.
No traces in the dashboardThe apps cannot reach localhost:4317, or the dashboard container is not running.docker compose up -d --wait, check OTEL_EXPORTER_OTLP_ENDPOINT in appsettings.json, place a new order.
Many one-span traces of outbox pollingNpgsql tracing records every command.Keep the ConfigureCommandFilter(_ => Activity.Current is not null) from step 09.
One-span CONNECT orders traces every second while PostgreSQL is downThe command filter does not cover connection opens; each failed poll opens a new connection.Expected during an outage. To hide them, add .EnablePhysicalOpenTracing(false) next to ConfigureCommandFilter.
/health/ready returns 503 but orders still workThe broker is down. The outbox keeps orders working; readiness reports the outage.Start RabbitMQ (docker compose start rabbitmq). The client reconnects by itself.
Outbox check Degraded with givenUp greater than 0Rows reached MaxAttempts and are no longer retried.Read last_error, fix the cause, then reset: update outbox_messages set attempts = 0, next_attempt_at = null where processed_at is null.
Port 5080, 5432/5433, 5672, 15672, 18888 or 4317 already in useAnother process or an earlier run is still listening.Stop it (lsof -nP -iTCP:<port> -sTCP:LISTEN shows who), or change the port in docker-compose.yml / launchSettings.json.
dotnet ef: command not foundThe local tool is not restored.dotnet tool restore.

MIT licensed. Every step is a commit: git checkout step-01.