Debugging Guides

Distinguish symptoms from root causes, then verify the fix.

697 published

Page 7 of 7

Vite — WebSocket connection failed for HMR behind a proxy

Fix Vite HMR websocket failures by configuring the dev server host, port and proxy for the environment.

intermediate
debugging · node · vite

Webhooks — HMAC Signature Validation Fails After No Code Change

Fix webhook signature verification failures caused by body parsing order, encoding, and timestamp tolerance, and compare digests in constant time.

intermediate
debugging · webhooks · hmac · security

webpack — Module parse failed: Unexpected token

Fix webpack parse failures by adding the right loader for the file type and excluding build artifacts from rule matching.

intermediate
debugging · node · webpack

WebSocket — close code 1001 going away disconnects clients

Diagnose WebSocket 1001 closures by identifying scheduled restarts, idle proxies and deployment churn.

intermediate
debugging · websocket · networking

C# NullReferenceException — Enable Nullable and Find the Null

Diagnose C# NullReferenceException by reading the stack trace, enabling nullable reference types, and fixing uninitialized dependencies, LINQ defaults, and async results.

beginner
debugging · csharp · dotnet

DNS SERVFAIL — DNSSEC, Delegation, and Resolver Failures

Diagnose DNS SERVFAIL by comparing resolvers, checking the authoritative servers, validating DNSSEC with delv, and fixing delegation or zone-signing problems.

advanced
debugging · dns · dnssec

Docker build context too large — Speed Up Builds with .dockerignore

Diagnose oversized Docker build contexts by measuring directory size and transfer output, then exclude node_modules, .git, and artifacts with .dockerignore.

beginner
debugging · docker · build

Docker Hub pull rate limit — toomanyrequests in CI and Kubernetes

Diagnose Docker Hub rate limit errors by checking the pull token and rate limit headers, then authenticate, mirror, and cache images to keep CI and clusters pulling.

beginner
debugging · docker · registry

Docker Permission Denied — Cannot Connect to the Daemon Socket

Fix permission denied on /var/run/docker.sock by checking group membership, socket ownership, Docker context, and rootless daemon paths before relaxing permissions.

beginner
debugging · docker · linux · permissions

Elasticsearch yellow cluster — Unassigned Replica Shards Explained

Diagnose Elasticsearch yellow cluster health by inspecting unassigned replicas, allocation explain output, disk watermarks, and node roles before adding capacity.

intermediate
debugging · elasticsearch · cluster-health

Git LFS pointer file — Why the Binary Is Just Text

Diagnose Git LFS pointer files by checking filters, attributes, and lfs status, then install hooks, pull objects, or migrate files committed without LFS.

beginner
debugging · git · git-lfs

Git merge conflict — Resolve Markers Without Losing Changes

Diagnose and resolve Git merge conflicts by listing unmerged paths, reading both sides, choosing a semantic resolution, and verifying with tests before committing.

beginner
debugging · git · merge

GitHub Actions Cache Miss — Why the Cache Never Restores

Diagnose GitHub Actions cache misses caused by unstable keys, branch scoping, and eviction, then design a key and restore-keys strategy that actually hits.

beginner
debugging · github-actions · ci-cd · caching

Go Deadlock — all goroutines are asleep

Diagnose Go deadlocks from channel sends, WaitGroup misuse, and lock ordering by reading goroutine dumps from SIGQUIT, test timeouts, and pprof profiles.

advanced
debugging · go · concurrency · deadlock

Go HTTP client timeout — context deadline exceeded Explained

Diagnose Go HTTP timeouts by measuring connect, TLS, and first-byte latency, then setting client, transport, and context deadlines that match real upstream behavior.

intermediate
debugging · go · http

Go slice bounds out of range — Off-by-One and Capacity Traps

Diagnose Go slice bounds panics by reading the reported index and capacity, checking len versus cap, and adding explicit guards and edge-case tests.

beginner
debugging · go · slices

HAProxy 503 no server available — Fix Failed Backend Health Checks

Diagnose HAProxy 503 errors by reading the runtime stats socket, identifying DOWN servers and check failures, then correcting health check probes and timeouts.

intermediate
debugging · haproxy · load-balancing

Java ClassNotFoundException — Missing Class on the Runtime Classpath

Trace ClassNotFoundException from packaging to runtime classpath by inspecting the jar, dependency tree, and class loader instead of adding random libraries.

intermediate
debugging · java · classpath · jvm

Java deadlock — Read jstack and Fix Lock Ordering

Diagnose Java deadlocks by capturing a jstack thread dump, reading the deadlock report and lock owners, then enforcing a global lock order or using tryLock timeouts.

advanced
debugging · java · concurrency

Java GC overhead limit exceeded — Find the Allocation Pressure

Diagnose GC overhead limit errors with jstat, heap histograms, and GC logs, then fix leaks and allocation hotspots before increasing the heap.

advanced
debugging · java · gc

Jest did not exit — Find and Fix Open Handles

Diagnose Jest hanging after tests by running detectOpenHandles, identifying servers, timers, and database clients left open, then closing them in afterAll hooks.

intermediate
debugging · jest · testing

JWT invalid signature — Secret, Algorithm, and Key Rotation

Diagnose JWT invalid signature errors by decoding the header, verifying with the correct algorithm and key, checking kid rotation, and reproducing the exact bytes.

intermediate
debugging · jwt · authentication

Kafka Consumer Lag — Find Stuck Partitions and Rebalance Storms

Diagnose growing Kafka consumer group lag with consumer-group tooling, partition counts, poll interval limits, and processing time measurements before adding consumers.

advanced
debugging · kafka · streaming · performance

Kafka producer TimeoutException — Expiring Records in Batch

Diagnose Kafka producer timeouts by checking topic metadata, ISR health, and delivery timeout budgets, then fix acks, linger, retries, and broker capacity.

advanced
debugging · kafka · producer

Kafka rebalance storm — Why Consumer Groups Keep Rebalancing

Diagnose Kafka rebalance storms by reading coordinator logs and consumer group generation changes, then tune poll intervals, batch sizes, and static membership.

advanced
debugging · kafka · consumer-groups

Kubernetes Evicted Pod — Node Pressure and Ephemeral Storage

Diagnose Kubernetes pod evictions by reading eviction messages and node pressure conditions, then fix resource requests, ephemeral storage limits, and kubelet GC.

intermediate
debugging · kubernetes · eviction

Kubernetes Pending Pod — Schedule Failures and PVC Binding

Diagnose Kubernetes Pending pods by reading scheduler events, node allocatable resources, taints, affinity rules, and PVC binding, then correct the manifest.

beginner
debugging · kubernetes · scheduling

Kubernetes readiness probe failing — Running but Never Ready

Diagnose Kubernetes readiness probe failures by testing the probe endpoint inside the pod, reviewing probe timing and app dependencies, then fixing startup and health routes.

beginner
debugging · kubernetes · health-checks

Linux disk full — No Space Left on Device With Free Space

Diagnose Linux disk-full errors by checking blocks and inodes, finding deleted-but-open files, and locating log or container growth before cleaning safely.

beginner
debugging · linux · disk

Linux OOM killer — Identify the Killed Process and Prevent It

Diagnose Linux OOM kills with dmesg and journalctl, identify the victim and cgroup limit, then fix leaks, concurrency, and memory sizing instead of disabling overcommit.

intermediate
debugging · linux · memory

Linux Too Many Open Files — Find the Leaking File Descriptor

Resolve EMFILE and Too many open files errors by counting descriptors per process, identifying the leaked resource, and sizing systemd and kernel limits correctly.

intermediate
debugging · linux · file-descriptors · systemd

MongoDB slow query — Use the Profiler and explain() to Find It

Diagnose MongoDB slow queries with the database profiler and executionStats, then fix collection scans, missing indexes, and oversized result sets.

intermediate
debugging · mongodb · performance

MySQL ERROR 1040 Too many connections — Diagnose and Fix

Diagnose MySQL ERROR 1040 by measuring Threads_connected against max_connections, inspecting processlist sleepers, then fixing leaks, wait_timeout, and pool sizing.

intermediate
debugging · mysql · connections

Nginx 502 Bad Gateway — Upstream Connection Refused or Closed

Diagnose nginx 502 errors by reading the error log, testing the upstream directly, and checking listener addresses, timeouts, and proxy protocol settings.

beginner
debugging · nginx · proxy

nginx 504 — Upstream Timed Out While Reading Response Headers

Diagnose nginx 504 upstream timed out errors by measuring the backend directly, checking proxy timeouts and buffering, and fixing slow handlers before raising limits.

intermediate
debugging · nginx · reverse-proxy · timeouts

Node.js ECONNRESET — Keep-Alive Socket Closed by the Server

Fix read ECONNRESET and socket hang up in Node.js by tracing reused keep-alive sockets, aligning agent and server timeouts, and retrying only idempotent requests.

intermediate
debugging · nodejs · http · networking

npm ERESOLVE peer dependency conflict — Resolve Without --force

Diagnose npm ERESOLVE errors with npm ls, npm explain, and peerDependencies metadata, then align versions or use targeted overrides instead of disabling peer checks.

beginner
debugging · npm · dependencies

PHP Fatal error — Undefined Function and Class Not Found

Diagnose PHP fatal errors by linting the file, reproducing with full error reporting, checking extensions and autoloading, then fixing namespaces and composer class maps.

beginner
debugging · php · fatal-error

Playwright test timeout — Debug Locator and Navigation Waits

Diagnose Playwright timeouts with traces, headed debugging, and single-worker runs, then replace fixed sleeps with web-first assertions and stable locators.

intermediate
debugging · playwright · testing

pnpm ERR_PNPM_OUTDATED_LOCKFILE — Fix Frozen Lockfile Failures

Diagnose pnpm frozen-lockfile failures by comparing package.json with pnpm-lock.yaml, aligning the pnpm version, and regenerating and committing the lockfile.

beginner
debugging · pnpm · lockfile

PostgreSQL Connection Reset — Server Closed the Connection Unexpectedly

Diagnose PostgreSQL connection resets after idle periods by comparing backend logs, idle session age, and infrastructure timeouts, then fix keepalive and pool lifetime.

intermediate
debugging · postgresql · networking · connection-pool

PostgreSQL no pg_hba.conf entry — Fix Host-Based Authentication

Diagnose PostgreSQL FATAL: no pg_hba.conf entry errors by reading pg_hba_file_rules, matching client address and SSL mode, then adding and reloading a host rule.

beginner
debugging · postgresql · authentication

PostgreSQL idle in transaction — Long Sessions Holding Locks

Find PostgreSQL sessions stuck in idle in transaction, measure how long they hold locks and snapshots, then enforce transaction timeouts and fix application boundaries.

intermediate
debugging · postgresql · transactions

Python asyncio timeout — TimeoutError, Blocked Loop, and Slow Tasks

Diagnose asyncio timeouts by timing coroutines, finding blocking calls, checking downstream latency and concurrency limits, then applying explicit timeout budgets.

intermediate
debugging · python · asyncio

Python ModuleNotFoundError and circular ImportError — Fix Imports

Diagnose Python import failures by checking sys.executable and sys.path, finding shadowing modules and circular imports, then installing into the active environment.

beginner
debugging · python · imports

Python CERTIFICATE_VERIFY_FAILED — Trust Store and CA Bundle Fixes

Fix Python SSL certificate verification failures by auditing the CA bundle, corporate interception, environment overrides, and clock skew without disabling verification.

intermediate
debugging · python · tls · certificates

RabbitMQ queue backlog — Find the Bottleneck Behind Growing Depth

Diagnose RabbitMQ queue backlog by comparing ready, unacknowledged, and consumer counts, then fix slow consumers, prefetch, requeue loops, and memory alarms.

intermediate
debugging · rabbitmq · queues

Redis MOVED redirect — Fix Cluster Slot Routing Errors

Diagnose Redis cluster MOVED errors by checking slot ownership, node announcements, and client topology refresh, then configure a cluster-aware client correctly.

intermediate
debugging · redis · cluster

Redis Command Timeout — Separate Slow Commands from Network Delays

Track down Redis client timeouts by separating blocking commands from network and pool problems using SLOWLOG, latency probes, and INFO statistics instead of raising timeouts.

intermediate
debugging · redis · performance · timeouts

Ruby LoadError cannot load such file — Bundler and Gems Explained

Diagnose Ruby LoadError by running through bundle exec, checking bundle check and the load path, then fixing missing gems, platform locks, and native extensions.

beginner
debugging · ruby · bundler

Rust E0382 borrow of moved value — Ownership Fixes That Compile

Diagnose Rust move and borrow errors by reading the compiler's move trace, then choose borrowing, cloning, split borrows, or mem::take deliberately.

intermediate
debugging · rust · ownership

Cargo Lock Conflict — Failed to Select a Version for the Requirement

Resolve Cargo version selection and lockfile conflicts by inspecting the dependency tree, aligning semver requirements, and regenerating Cargo.lock in the right place.

intermediate
debugging · rust · cargo · dependencies

TLS handshake failure — Certificate, SNI, and Cipher Mismatch

Diagnose TLS handshake failures with openssl s_client and curl verbose output, checking certificate chains, SNI virtual hosts, protocol versions, and client trust.

intermediate
debugging · tls · openssl

Vite optimize deps — Missing Exports and Reload Loops

Diagnose Vite dependency pre-bundling problems by clearing the cache, reading optimize debug output, and configuring include, exclude, and dedupe for linked packages.

intermediate
debugging · vite · bundler

Webpack JavaScript heap out of memory — Production Build OOM Fix

Diagnose webpack heap exhaustion by measuring build memory and stats, then raise Node's heap, disable heavy source maps, split chunks, and reduce module graph size.

intermediate
debugging · webpack · memory

WebSocket 1006 abnormal closure — Proxy Upgrade and Idle Timeouts

Diagnose WebSocket 1006 errors by checking the handshake response, proxy Upgrade headers, idle timeouts, and server crashes, then add heartbeats and clean reconnects.

intermediate
debugging · websocket · nginx

CSS — z-index has no effect

Diagnose z-index failures caused by stacking contexts, parent stacking order, and transform or opacity, then fix the layout instead of escalating numbers.

intermediate
debugging · css · layout

Docker Compose — depends_on does not wait for readiness

Fix startup races where an app starts before its database or queue is ready by adding healthchecks and condition-based dependencies, plus application retries.

beginner
debugging · docker · compose

Docker — exec format error on container start

Diagnose exec format errors caused by an arm64/amd64 image or binary mismatch, verify the platform digest, and build a multi-architecture image.

intermediate
debugging · docker · architecture

Docker — no space left on device

Diagnose Docker disk exhaustion from images, containers, volumes, build cache, logs, or inodes, and reclaim space without deleting active data.

intermediate
debugging · docker · storage

Git — push rejected (non-fast-forward)

Diagnose a rejected Git push by comparing local and remote history, rebasing or merging deliberately, and avoiding destructive force-pushes on shared branches.

beginner
debugging · git · version-control

Go — context deadline exceeded

Find which deadline expired in a Go call chain, distinguish a caller timeout from a dependency timeout, and fix propagation instead of increasing timeouts blindly.

intermediate
debugging · go · context · timeouts

Go — data race detected by the race detector

Read a Go race report, identify the conflicting accesses, and fix the synchronization with a mutex, channel, or atomic rather than ignoring the warning.

advanced
debugging · go · concurrency

Java — OutOfMemoryError: Java heap space

Diagnose a Java heap exhaustion with heap dumps, GC logs, and allocation analysis, and fix the leak or sizing instead of only raising -Xmx.

advanced
debugging · java · memory

Kubernetes — CrashLoopBackOff

Diagnose CrashLoopBackOff from pod events, previous logs, and exit codes, then fix the application, probe, configuration, or resource limit that restarts the container.

intermediate
debugging · kubernetes · containers

Kubernetes — ImagePullBackOff

Diagnose ImagePullBackOff from pod events and registry authentication, covering wrong tags, missing pull secrets, architecture mismatches, and rate limits.

intermediate
debugging · kubernetes · containers

MySQL — Lock wait timeout exceeded

Diagnose MySQL lock waits from long transactions, missing indexes, or conflicting update order, and fix the wait instead of only raising the timeout.

advanced
debugging · mysql · database

Nginx — 413 Request Entity Too Large

Diagnose uploads rejected by Nginx with 413, align client_max_body_size across proxy and app, and return a clear JSON error without weakening limits.

beginner
debugging · nginx · uploads

Node.js — JavaScript heap out of memory

Diagnose a Node.js heap exhaustion by capturing a heap snapshot, finding retained objects, and fixing the leak instead of only raising the heap limit.

advanced
debugging · nodejs · memory

Node.js — Unhandled promise rejection

Find the promise that rejected without a handler, fix floating async calls and async event handlers, and add a process-level safety net without swallowing errors.

intermediate
debugging · nodejs · async

PHP — Allowed memory size exhausted

Diagnose PHP memory exhaustion by locating the peak allocation, fixing unbounded data loading, and raising memory_limit only with evidence.

intermediate
debugging · php · memory

PostgreSQL — deadlock detected

Diagnose PostgreSQL deadlocks by reading the server log, identifying conflicting lock order, shortening transactions, and adding bounded retries.

advanced
debugging · postgresql · transactions · locking

Python — RuntimeError: Event loop is closed

Trace an asyncio closed-loop error to repeated asyncio.run calls, closed clients, or test fixture scope, and fix the lifecycle instead of catching the error.

intermediate
debugging · python · asyncio

Python — KeyError on a Dictionary Lookup

Trace a Python KeyError to the missing key, distinguish an absent key from a None value, and choose between defaults, validation, and explicit errors.

beginner
debugging · python · dictionary

Python — pip dependency conflict (ResolutionImpossible)

Diagnose pip resolver failures by tracing direct and transitive constraints, relaxing incompatible pins, and using constraints files instead of disabling dependencies.

intermediate
debugging · python · packaging

Python — RecursionError: maximum recursion depth exceeded

Find the missing or unreachable base case, convert deep recursion to an explicit stack, and avoid raising the recursion limit as a substitute for a fix.

intermediate
debugging · python · recursion

Redis — OOM command not allowed

Diagnose Redis memory exhaustion by checking maxmemory, eviction policy, large keys, and fragmentation, then choose capacity or eviction deliberately.

intermediate
debugging · redis · memory

Rust — linking with cc failed

Diagnose Rust linker errors from missing native libraries, wrong target toolchains, feature flags, or duplicate symbols, and fix the build environment.

advanced
debugging · rust · build-tools

SQLite — database disk image is malformed

Diagnose SQLite corruption with integrity checks, preserve the file, recover data with .recover or a dump, and fix disk or lifecycle causes.

advanced
debugging · sqlite · database

SQLite — database is locked

Diagnose SQLITE_BUSY errors by shortening write transactions, enabling WAL and a busy timeout, and avoiding long-lived read locks.

intermediate
debugging · sqlite · database

TypeScript — TS2345 Argument Type Not Assignable

Diagnose and fix TypeScript error TS2345 by reading the full type, narrowing unions, handling optional properties, and avoiding unsafe any casts.

beginner
debugging · typescript · types

Vite / Webpack — Module not found

Diagnose unresolved imports caused by case sensitivity, aliases, package exports, missing dependencies, or the wrong working directory, and fix resolution without disabling checks.

beginner
debugging · javascript · build-tools

CORS Preflight Failed — Browser Blocks the Request

Diagnose preflight failures by inspecting the OPTIONS request and response headers, then fix origin, method, header, or credential configuration.

beginner
debugging · cors · http · browser

Docker — Port Is Already Allocated

Resolve Docker bind failures by identifying which container or host process already publishes the port, then changing or freeing the mapping without disrupting unrelated services.

beginner
debugging · docker · ports · containers

Git Detached HEAD — Commits Not on a Branch

Recover from a detached HEAD by attaching a new or existing branch before switching away, so commits are not left unreachable.

beginner
debugging · git · version-control

Go — Nil Pointer Dereference Panic

Trace a nil pointer panic from the stack trace, find the unchecked nil value, and fix it with explicit error handling and regression tests.

intermediate
debugging · go · nil · panic

HTTP 502 Bad Gateway — Proxy Cannot Reach the Upstream

Trace a 502 from the reverse proxy to the upstream service, distinguishing a down backend, a wrong address or port, a timeout, and an application crash.

intermediate
debugging · http · proxy · nginx

JavaScript Maximum Call Stack Exceeded

Find unbounded recursion or circular traversal behind RangeError, then convert to iteration, add a base case, or break cycles with a visited set.

intermediate
debugging · javascript · recursion · memory

Node.js EADDRINUSE — Port Already in Use

Diagnose and resolve EADDRINUSE when a Node.js server cannot bind a port because another process is listening or a previous instance did not exit cleanly.

beginner
debugging · nodejs · ports · dev-server

npm ERESOLVE — Peer Dependency Conflict

Resolve npm ERESOLVE errors by reading the dependency tree, aligning peer ranges, deduplicating versions, and using overrides only with a documented reason.

intermediate
debugging · npm · dependencies · nodejs

PostgreSQL — Too Many Connections

Diagnose connection exhaustion by measuring active, idle, and leaked sessions, then bound connection pools and release clients reliably.

intermediate
debugging · postgresql · database · performance

Python ModuleNotFoundError — Wrong Interpreter or Missing Dependency

Diagnose ModuleNotFoundError by confirming which interpreter runs the code, which environment holds the package, and whether the import name differs from the package name.

beginner
debugging · python · dependencies · virtualenv

React Hydration Mismatch — Server and Client HTML Differ

Diagnose hydration errors by finding non-deterministic render output, browser-only state, invalid HTML nesting, or locale differences between server and client.

intermediate
debugging · react · ssr · hydration

Rust — Cannot Borrow as Mutable More Than Once

Resolve E0499 and E0502 by shortening borrow scopes, restructuring data ownership, or using interior mutability only when runtime checking is truly required.

intermediate
debugging · rust · borrow-checker · ownership

Async Race Condition — Out-of-Order Responses

Diagnose and fix race conditions in concurrent async operations where later requests resolve before earlier ones, causing stale data to overwrite fresh results.

intermediate
debugging · async · race-condition · browser

Browser Memory Leak — Detached DOM Nodes

Identify and fix memory leaks caused by references to removed DOM nodes that prevent garbage collection when event listeners, closures, or data caches maintain strong references.

intermediate
debugging · performance · memory · browser · dom

React Infinite Render Loop — useState + useEffect Without Dependencies

Diagnose and fix infinite render loops caused by calling setState unconditionally inside useEffect without a dependency array.

intermediate
react · hooks · debugging · useEffect · performance