Skip to content
bitzorcas
中EN

Recipe

Troubleshooting Guide: Environment, Ports, Compilation, and Runtime Diagnostics

Resolving common BitzOrcas.Modern onboarding failures: verified port matrices (6881, 6880, 6800, 1433), SQL Server connectivity, Roslyn source generator cache resets, and HTTPS developer certificate trust.

Last updated

In modular monolith and containerized architectures, friction caused by environment drift, port collisions, or stale code-generation caches can abruptly halt development progress.

This document provides a verified troubleshooting matrix and rapid remediation commands grounded in the physical reality of the BitzOrcas codebase.

Physical Service & Port Topology Matrix

BitzOrcas.Modern Physical Port Topology

API Host: 6881 (HTTP) / 6883 (HTTPS)

YARP Gateway: 6880 (HTTP)

Web Admin Frontend: 6800 (HTTP)

SQL Server 2022: 1433 (Docker) / 14333 (Aspire)

Redis 7: 6379

RabbitMQ: 5672 (AMQP) / 15672 (UI)

MinIO: 9000 (S3 API) / 9001 (Console)

AgileConfig: 15000 (Config Center)


1. Port Collisions & Process Termination (Address Already in Use)

When startup aborts with System.IO.IOException: Failed to bind to address: address already in use, locate and terminate the conflicting process using the commands below:

ServiceDefault PortmacOS / Linux Process TerminationWindows PowerShell Termination
API Host6881 / 6883lsof -ti :6881,6883 | xargs kill -9Get-NetTCPConnection -LocalPort 6881 -ErrorAction SilentlyContinue | ForEach-Object { Stop-Process -Id $_.OwningProcess -Force }
YARP Gateway6880lsof -ti :6880 | xargs kill -9Get-NetTCPConnection -LocalPort 6880 -ErrorAction SilentlyContinue | ForEach-Object { Stop-Process -Id $_.OwningProcess -Force }
Web Frontend6800lsof -ti :6800 | xargs kill -9Get-NetTCPConnection -LocalPort 6800 -ErrorAction SilentlyContinue | ForEach-Object { Stop-Process -Id $_.OwningProcess -Force }
SQL Server1433 / 14333lsof -ti :1433 | xargs kill -9Get-NetTCPConnection -LocalPort 1433 -ErrorAction SilentlyContinue | ForEach-Object { Stop-Process -Id $_.OwningProcess -Force }
Redis6379lsof -ti :6379 | xargs kill -9Get-NetTCPConnection -LocalPort 6379 -ErrorAction SilentlyContinue | ForEach-Object { Stop-Process -Id $_.OwningProcess -Force }
RabbitMQ5672 / 15672lsof -ti :5672,15672 | xargs kill -9Get-NetTCPConnection -LocalPort 5672 -ErrorAction SilentlyContinue | ForEach-Object { Stop-Process -Id $_.OwningProcess -Force }

2. Database Connectivity Failures & Handshake Timeouts

Common Exceptions:

  • Microsoft.Data.SqlClient.SqlException: Cannot open database "BitzOrcas_Dev" requested by the login.
  • A connection was successfully established with the server, but then an error occurred during the pre-login handshake.

Remediation Steps:

  1. Verify Container Health Probe: Execute docker compose ps and confirm the SQL Server container indicates (healthy). SQL Server requires 10–15 seconds post-startup to complete internal initialization. Attempting schema creation before health reports ready triggers pre-login timeouts.
  2. Apple Silicon (M1/M2/M3/M4) Emulation Delay: Official SQL Server images exist solely for linux/amd64. On macOS running Docker Desktop or OrbStack, execution depends on Rosetta 2 emulation. Initial cold starts can require 30+ seconds.
  3. Database Unprovisioned: The exception Cannot open database "BitzOrcas_Dev" indicates the catalog does not yet exist. Run the built-in provisioning command:
    Terminal window
    dotnet run --project src/Hosts/BitzOrcas.Api -- --init-schema

3. Roslyn Source Generator Stale Cache

Symptoms: Adding a [GenerateEndpoint] command or [BitzTable] attribute compiles with missing-symbol errors in the IDE, or returns HTTP 404 at runtime.

Root Cause: IDE background language servers (in Rider or Visual Studio) occasionally cache stale syntax trees, failing to trigger incremental compilation passes.

Remediation:

Purge build artifacts and force clean compilation
# 1. Clean bin and obj folders across the entire solution
git clean -xfd -e "!*.env*" src/ tests/
# 2. Force non-incremental build to re-evaluate syntax trees
dotnet build --no-incremental

4. HTTPS Developer Certificate Untrusted (SSL Error)

Symptoms:

  • Browser network inspectors report net::ERR_CERT_AUTHORITY_INVALID when frontend requests target https://localhost:6883.
  • Scalar documentation reports untrusted TLS certificate warnings.

Remediation:

Reset and re-trust developer certificates
# 1. Purge all expired development certificates
dotnet dev-certs https --clean
# 2. Issue and register a new trusted root certificate
dotnet dev-certs https --trust

On Linux distributions lacking unified root trust stores, target the plain HTTP endpoint http://localhost:6881 during local development.


5. Double-Underscore Environment Variable Mapping Traps

Symptoms: Executing export ConnectionStrings:Default="..." results in the host reporting empty connection strings at startup.

Root Cause: POSIX-compliant shells (Bash, Zsh) prohibit colons : in environment variable identifiers. In the Microsoft configuration system, hierarchical keys must be delimited using double underscores (__):

Valid vs. Invalid environment variable syntax
# Invalid (Colons are truncated or rejected by standard shells)
export ConnectionStrings:Default="Server=..."
# Valid (Double underscore maps automatically to ConnectionStrings:Default)
export ConnectionStrings__Default="Server=localhost,1433;Database=BitzOrcas_Dev;User Id=sa;Password=YourStrong!Passw0rd;TrustServerCertificate=True;MultipleActiveResultSets=True;"

At startup, ConnectionStrings__Default maps seamlessly to IConfiguration["ConnectionStrings:Default"].

100%

Scroll or use controls to zoom · drag when enlarged · double-click for 100% / 200%