Cheat sheet: Error codes & fixes
Look up an error: HTTP 404/502/503/504, exit codes 126/127/137/143, CrashLoopBackOff, ImagePullBackOff, Permission denied, no space left on device, git rejected, state lock. Meaning, causes and the diagnose command.
Type the code or the message in the filter (404, 137, CrashLoopBackOff, permission denied) and click it:
you get what it means, the usual causes & fixes, and a command to diagnose it, explained part by part.
HTTP status codes & TLS15
curl -sSIL <url>301 / 302Redirect: see every hopWhat it means
301 Moved Permanently / 302 Found: the resource is at another URL, given in the
Locationheader. Not an error by itself.Usual causes & fixes
- Redirect loop (ERR_TOO_MANY_REDIRECTS): HTTP→HTTPS redirect behind a load balancer that terminates TLS. The app sees HTTP every time; trust
X-Forwarded-Proto. - Wrong host or missing trailing slash in the
Locationheader. - Old path after a move: update the link or add a permanent redirect.
Diagnose: what each part of the command does
curlmake an HTTP request-s -Sno progress bar, but still show errors-Iheaders only (HEAD request)-Lfollow redirects, printing the headers of every hop<url>the address you are testing
- Redirect loop (ERR_TOO_MANY_REDIRECTS): HTTP→HTTPS redirect behind a load balancer that terminates TLS. The app sees HTTP every time; trust
curl -v -X POST -H "Content-Type: application/json" -d @<file>.json <url>400Bad Request: look at exactly what you sendWhat it means
The server will not process the request because of a client error: malformed syntax, invalid framing, bad parameters.
Usual causes & fixes
- Invalid JSON: check it with
jq . <file>.json. - Missing or wrong
Content-Typeheader. - Headers or cookies too large (nginx: "Request Header Or Cookie Too Large" → raise
large_client_header_buffers). - Required field missing: read the response body, APIs usually say which one.
Diagnose: what each part of the command does
-vverbose: print request and response headers-X POSTHTTP method-H "Content-Type: application/json"tell the server the body is JSON-d @<file>.jsonsend the body from a file (@ = read file)
- Invalid JSON: check it with
curl -i -H "Authorization: Bearer <token>" <url>401Unauthorized: test the credentialsWhat it means
"Unauthenticated": the request has no valid credentials. The
WWW-Authenticateresponse header says which scheme is expected.Usual causes & fixes
- Token missing, expired or for the wrong environment.
- Wrong scheme: Bearer vs Basic vs an API-key header.
- Clock skew makes a fresh JWT look expired/not-yet-valid: check
timedatectl. - A proxy (basic auth, oauth2-proxy) in front of the app asks for its own login.
Diagnose: what each part of the command does
-iinclude response headers in the output-H "Authorization: Bearer <token>"send the token the way the API expects
namei -l <path-to-file>403Forbidden: check the server log and the file pathWhat it means
The server knows who you are but refuses access.
Usual causes & fixes
- nginx/Apache: the web server user needs
xon every parent folder andron the file (see namei output). Checksudo tail -n 50 /var/log/nginx/error.log. - Folder requested but no index file and autoindex off → 403.
- IP allow/deny list, WAF rule, or a cloud bucket policy.
- Kubernetes API "forbidden": RBAC. Check with
kubectl auth can-i <verb> <resource> -n <namespace>.
Diagnose: what each part of the command does
nameifollow a path one component at a time-llong format: owner, group and permissions of EVERY directory on the way<path-to-file>e.g. /var/www/site/index.html
- nginx/Apache: the web server user needs
curl -sS -o /dev/null -w "%{http_code} %{url_effective}\n" -L <url>404Not Found: what does the server actually return?What it means
The server cannot find the requested resource. For an API it can also mean the endpoint exists but the object does not.
Usual causes & fixes
- Typo or wrong path/base path (e.g. app served under /api but called at /).
- nginx
location/root/aliaspoints somewhere else:nginx -T | grep -n -A5 "location". - Kubernetes ingress host or path does not match (see the next entry).
- Static site: file not deployed, or case-sensitive name (Index.html vs index.html).
Diagnose: what each part of the command does
-sSquiet, show errors-o /dev/nulldiscard the body-w "%{http_code} %{url_effective}\n"print the final status and the final URL after redirects-Lfollow redirects
kubectl get ingress -A; kubectl describe ingress <ingress> -n <namespace>404Not Found behind a Kubernetes ingressWhat it means
The ingress controller answered but no rule matched the host + path (often the controller's default 404 page).
Usual causes & fixes
- Host header does not match the
host:rule (test withcurl -H "Host: <host>" http://<ingress-ip>/<path>). pathType: ExactvsPrefix, or a rewrite annotation changing the path.- Wrong
ingressClassName, so a different controller (or none) owns the ingress.
Diagnose: what each part of the command does
get ingress -Aall ingresses with their HOSTS and ADDRESSdescribe ingress <ingress>rules: host + path → service:port, and events-n <namespace>namespace of the ingress
- Host header does not match the
curl -i -X OPTIONS <url>405Method Not Allowed: which methods are allowed?What it means
The method (GET/POST/PUT…) is known but not supported for this URL.
Usual causes & fixes
- POST to a static location, or GET to a POST-only endpoint.
- A proxy or ingress rule only allows some methods.
- CORS preflight (OPTIONS) not handled by the API.
Diagnose: what each part of the command does
-ishow response headers-X OPTIONSask the server which methods it supports (Allow header)
grep -rn "client_max_body_size" /etc/nginx/413Content Too Large: find the body size limitWhat it means
The request body is larger than the server allows.
Usual causes & fixes
- nginx: raise
client_max_body_size 50m;in the http/server/location block, thensudo nginx -t && sudo systemctl reload nginx. - ingress-nginx: annotation
nginx.ingress.kubernetes.io/proxy-body-size: "50m". - App or framework upload limit as well.
Diagnose: what each part of the command does
grep -rnsearch recursively with line numbers"client_max_body_size"nginx directive that limits upload size/etc/nginx/nginx config folder
- nginx: raise
curl -sI <url> | grep -i -E "retry-after|ratelimit"429Too Many Requests: read the rate-limit headersWhat it means
You sent too many requests in a given time (rate limiting).
Usual causes & fixes
- Wait for
Retry-Afterseconds; add backoff with jitter to clients. - Retry storm from many pods sharing one egress IP / API key.
- Docker Hub "toomanyrequests" on image pulls:
docker loginor use a mirror.
Diagnose: what each part of the command does
curl -sIquiet, headers only| grep -i -Ecase-insensitive, extended regex filter"retry-after|ratelimit"Retry-After and X-RateLimit-* headers
- Wait for
kubectl logs <pod> -n <namespace> --tail=100500Internal Server Error: read the application logsWhat it means
Generic "the server hit something it does not know how to handle": the app crashed or threw.
Usual causes & fixes
- Unhandled exception: the stack trace is in the app log (
docker logs <container>/journalctl -u <service>). - Bad config or missing env var after a deploy: compare with the previous version, roll back if needed.
- Downstream dependency (DB, cache) down or credentials rotated.
Diagnose: what each part of the command does
kubectl logs <pod>app output (stack traces end up here)-n <namespace>namespace--tail=100last 100 lines
- Unhandled exception: the stack trace is in the app log (
sudo tail -n 50 /var/log/nginx/error.log502Bad Gateway: the proxy got no valid answer from the appWhat it means
The gateway/proxy received an invalid response from the upstream (your app).
Usual causes & fixes
- App not running or crashed: check
systemctl status <service>/ pod status. - Proxy points to the wrong port (
proxy_pass/ ServicetargetPort). - App listens on 127.0.0.1 inside a container instead of 0.0.0.0.
- TLS mismatch: proxy speaks HTTP to an HTTPS backend or the reverse.
Diagnose: what each part of the command does
sudolog files are root-onlytail -n 50last 50 lines/var/log/nginx/error.lognginx error log: says why the upstream failed (connection refused, reset, …)
- App not running or crashed: check
kubectl get endpointslices -l kubernetes.io/service-name=<service> -n <namespace>502 / 503Kubernetes service has no ready pods behind itWhat it means
Empty ENDPOINTS = the Service has nowhere to send traffic, so the ingress returns 502/503.
Usual causes & fixes
- Service
selectordoes not match the pod labels: comparekubectl get svc <service> -o yamlwithkubectl get pods --show-labels. - Pods exist but are not Ready: readiness probe failing (
kubectl describe pod <pod>→ Events). targetPortdoes not match the containerPort.
Diagnose: what each part of the command does
get endpointslicesthe pod IPs a Service actually sends traffic to-l kubernetes.io/service-name=<service>only the slices of that Service-n <namespace>namespace
- Service
kubectl get pods -l app=<app> -n <namespace> -o wide503Service Unavailable: are the pods ready?What it means
The server is not ready to handle the request: down for maintenance or overloaded. Often sent with
Retry-After.Usual causes & fixes
- READY 0/1: readiness probe failing (wrong path/port, app still starting).
- All replicas restarting or scaled to 0.
- Maintenance mode or circuit breaker in the proxy/mesh (Envoy "no healthy upstream").
Diagnose: what each part of the command does
-l app=<app>pods of that app-o wideshow node and IP too
curl -sS -o /dev/null -w "connect=%{time_connect}s ttfb=%{time_starttransfer}s total=%{time_total}s\n" <url>504Gateway Timeout: how long does the backend take?What it means
The gateway did not get a response from the upstream in time.
Usual causes & fixes
- Backend slower than the proxy timeout: nginx
proxy_read_timeoutdefaults to 60s; cloud load balancers have their own idle timeout. - Slow DB query or external call: check app/DB logs.
- Network path blocked (security group / firewall) so the connect hangs.
Diagnose: what each part of the command does
-o /dev/nulldiscard body%{time_connect}time to open the TCP connection%{time_starttransfer}time to first byte: how long the backend "thought"%{time_total}whole request
- Backend slower than the proxy timeout: nginx
echo | openssl s_client -connect <host>:443 -servername <host> 2>/dev/null | openssl x509 -noout -subject -issuer -datesTLSCertificate expired / not trusted: inspect the certWhat it means
Errors like "certificate has expired", "unable to get local issuer certificate" or "hostname mismatch" come from the certificate the server presents.
Usual causes & fixes
- Expired: renew (cert-manager / certbot) and reload the server.
- Missing intermediate chain: serve the full chain (fullchain.pem).
- Hostname not in the SAN list, or wrong SNI/default certificate.
Diagnose: what each part of the command does
echo |send an empty request so s_client exitsopenssl s_client -connect <host>:443do a TLS handshake-servername <host>SNI: ask for the certificate of this host name2>/dev/nullhide handshake noiseopenssl x509 -nooutparse the certificate, do not print it-subject -issuer -dateswho it is for, who signed it, valid from / until
Exit codes10
echo $?$?What did the last command return?What it means
Every command returns a number 0-255. 0 means success. CI jobs and
&&use it.Usual causes & fixes
- Check it right after the command; the next command overwrites it.
- In scripts use
set -eto stop on the first failure,set -o pipefailto catch failures inside pipes.
Diagnose: what each part of the command does
echoprint$?exit status of the last command: 0 = success, anything else = failure
bash -x <script>.sh1General error: trace the scriptWhat it means
Catch-all for general errors: the program failed and chose 1.
Usual causes & fixes
- Read the last lines of stderr: the real message is usually there.
- A command inside the script failed:
-xshows which one.
Diagnose: what each part of the command does
bashrun the script with bash-xprint every command (with expanded variables) before running it
<command> --help2Misuse / wrong argumentsWhat it means
Bash builtins return 2 for incorrect usage (invalid option, missing argument); many tools follow this.
Usual causes & fixes
- Typo in a flag or a missing required argument.
- Shell syntax error in a script.
Diagnose: what each part of the command does
--helpshow valid options and arguments
ls -l <file>; file <file>126Found but cannot executeWhat it means
The command exists but is not executable.
Usual causes & fixes
- Missing execute bit:
chmod +x <file>. - Windows line endings in a script:
sed -i 's/\r$//' <file>(or dos2unix). - Filesystem mounted
noexec:findmnt -o TARGET,OPTIONS -T <file>.
Diagnose: what each part of the command does
ls -l <file>check the x permission bitfile <file>check the type: script with CRLF line terminators, wrong binary format…
- Missing execute bit:
command -v <command> || echo "not found; PATH=$PATH"127Command not foundWhat it means
The shell could not find the program in any PATH folder.
Usual causes & fixes
- Not installed (install it with apt/dnf/apk).
- Installed in a folder not on PATH (e.g. ~/.local/bin):
export PATH="$HOME/.local/bin:$PATH". - Typo, or a container image that does not include the tool (distroless, alpine without bash).
Diagnose: what each part of the command does
command -v <command>print where the command is, or nothing if it is not found||if that failed…echo "…PATH=$PATH"…show the folders the shell searches
kill -l $(( <exit-code> - 128 ))128+NKilled by a signal: which one?What it means
When a process dies from signal N, the shell reports 128+N. E.g. 137 → 9 (KILL), 143 → 15 (TERM), 130 → 2 (INT).
Usual causes & fixes
- Run it with the code you got, e.g.
kill -l $(( 137 - 128 ))prints KILL.
Diagnose: what each part of the command does
kill -l <number>print the signal name for a number$(( … ))shell arithmetic<exit-code> - 128exit codes above 128 mean "terminated by signal N"
- Run it with the code you got, e.g.
kill -l 2130Stopped with Ctrl+CWhat it means
128 + 2 (SIGINT): someone (or something) pressed Ctrl+C / sent an interrupt.
Usual causes & fixes
- Expected if you stopped it. In CI it usually means the job was cancelled.
Diagnose: what each part of the command does
kill -l 2signal 2 = INT, what Ctrl+C sends
dmesg -T | grep -i -E "out of memory|killed process"137Killed (SIGKILL): usually out of memoryWhat it means
128 + 9 (SIGKILL): the process was force-killed. In containers this is almost always the memory limit (OOMKilled).
Usual causes & fixes
- Docker:
docker inspect --format '{{.State.OOMKilled}}' <container>; raise-mor fix the leak. - Kubernetes:
kubectl describe pod <pod>→ Last State: Terminated, Reason: OOMKilled; raiseresources.limits.memory. - A human or script ran
kill -9, or a stop timed out and was escalated.
Diagnose: what each part of the command does
dmesg -Tkernel messages with readable timestampsgrep -i -E "out of memory|killed process"the OOM killer lines
- Docker:
dmesg -T | grep -i segfault139Segmentation fault (SIGSEGV)What it means
128 + 11 (SIGSEGV): the program accessed invalid memory and crashed.
Usual causes & fixes
- Bug in a native binary or library; version mismatch between binary and libs (e.g. glibc vs musl/alpine).
- Wrong CPU architecture image under emulation.
Diagnose: what each part of the command does
dmesg -Tkernel loggrep -i segfaultlines about the crash (which binary, which library)
docker inspect --format '{{.State.ExitCode}} {{.State.FinishedAt}}' <container>143Terminated (SIGTERM): asked to stopWhat it means
128 + 15 (SIGTERM): a graceful stop request: docker stop, a Kubernetes rollout/scale-down, systemctl stop.
Usual causes & fixes
- Normal during deploys and restarts.
- If unexpected: check who stopped it (events,
kubectl get events, systemd journal). - App should handle SIGTERM and exit cleanly within the grace period (
terminationGracePeriodSeconds, default 30s).
Diagnose: what each part of the command does
docker inspectcontainer details--format '…'print just the exit code and when it stopped
Kubernetes pod errors9
kubectl logs <pod> -n <namespace> --previousCrashLoopBackOffContainer keeps crashing: read the crashed runWhat it means
Not a phase: the container starts, exits, and Kubernetes keeps restarting it with increasing back-off.
Usual causes & fixes
- App exits at startup: missing env var, bad config, failed DB connection (see the log).
- OOMKilled / exit 137: raise the memory limit.
- Liveness probe kills a slow-starting app: add a startupProbe.
- Wrong command/args in the pod spec.
Diagnose: what each part of the command does
logs <pod>container output--previousfrom the previous (crashed) container, not the one restarting now
kubectl describe pod <pod> -n <namespace> | grep -A 10 EventsImagePullBackOffImage cannot be pulled: read the pull errorWhat it means
ErrImagePull / ImagePullBackOff: the kubelet could not pull the image and is backing off.
Usual causes & fixes
- Wrong image name or tag (typos, tag never pushed).
- Private registry without
imagePullSecrets. - Registry rate limit (Docker Hub "toomanyrequests") or the node cannot reach the registry.
- Check from your machine:
docker pull <image>:<tag>.
Diagnose: what each part of the command does
describe podfull status| grep -A 10 Eventsjump to the Events and show 10 lines after
kubectl describe pod <pod> -n <namespace>PendingPod not scheduled: why?What it means
The pod is accepted but not running: usually it cannot be scheduled onto any node.
Usual causes & fixes
- "Insufficient cpu/memory": requests too high or the cluster is full (scale nodes or lower requests).
- "had untolerated taint" / node selector or affinity matches no node.
- PersistentVolumeClaim not bound:
kubectl get pvc -n <namespace>.
Diagnose: what each part of the command does
describe podlook at Events: FailedScheduling explains the reason
kubectl get configmap,secret -n <namespace>CreateContainerConfigErrorMissing ConfigMap or SecretWhat it means
The container config refers to something that does not exist (usually a ConfigMap/Secret or a key in it).
Usual causes & fixes
- Create the missing ConfigMap/Secret, or fix the name/key in
envFrom/valueFrom. - It exists in another namespace: they are namespaced.
Diagnose: what each part of the command does
get configmap,secretlist both kinds at once
- Create the missing ConfigMap/Secret, or fix the name/key in
kubectl get pod <pod> -n <namespace> -o jsonpath='{.status.containerStatuses[*].lastState.terminated.reason}'OOMKilledWas the container killed for memory?What it means
The container used more memory than its limit and the kernel killed it (exit code 137).
Usual causes & fixes
- Raise
resources.limits.memory(and requests) or fix the leak; compare withkubectl top pod. - JVM/Node.js heap configured larger than the container limit.
Diagnose: what each part of the command does
-o jsonpath=…print one fieldlastState.terminated.reasonwhy the previous container instance ended (OOMKilled, Error, Completed)
- Raise
kubectl get pods -A --field-selector=status.phase=FailedEvictedPods evicted from a nodeWhat it means
The kubelet removed pods because the node ran short of memory or disk (or for maintenance).
Usual causes & fixes
- Check node pressure:
kubectl describe node <node>→ Conditions (DiskPressure, MemoryPressure). - Clean them up:
kubectl delete pods -A --field-selector=status.phase=Failed. - Set requests/limits and ephemeral-storage limits so pods are scheduled realistically.
Diagnose: what each part of the command does
-Aall namespaces--field-selector=status.phase=Failedevicted pods end up as Failed
- Check node pressure:
kubectl get events -n <namespace> --sort-by=.lastTimestampContainerCreatingStuck creating: volume or network problemWhat it means
The pod is on a node but the container has not started yet.
Usual causes & fixes
- FailedMount / FailedAttachVolume: PVC, Secret or ConfigMap volume not available.
- CNI / network sandbox errors: networking plugin problem on that node.
- Very large image still pulling.
Diagnose: what each part of the command does
get eventswhat the scheduler/kubelet reported--sort-by=.lastTimestampnewest last
kubectl auth can-i <verb> <resource> -n <namespace> --as=<user>ForbiddenRBAC: am I allowed to do this?What it means
"… is forbidden: User … cannot …": the identity has no Role/ClusterRole binding for that action.
Usual causes & fixes
- Add a RoleBinding / ClusterRoleBinding for the user or service account.
- Wrong context or namespace:
kubectl config current-context.
Diagnose: what each part of the command does
auth can-iask the API server whether an action is allowed (yes/no)<verb> <resource>e.g. get pods, create deployments--as=<user>check for another user or service account (system:serviceaccount:<ns>:<name>)
kubectl config current-context && kubectl cluster-infoUnable to connect"Unable to connect to the server" / "Unauthorized"What it means
kubectl cannot reach or authenticate to the API server.
Usual causes & fixes
- Wrong context, VPN off, or a private API endpoint.
- Expired credentials: refresh the kubeconfig (
aws eks update-kubeconfig,az aks get-credentials,gcloud container clusters get-credentials).
Diagnose: what each part of the command does
config current-contextwhich cluster kubectl is pointing at&&thencluster-infotry to reach the API server
Linux & SSH errors10
namei -l <path>Permission deniedWhich part of the path blocks me?What it means
The user lacks the permission needed: r to read, w to write, x to run a file or to enter a folder.
Usual causes & fixes
- Missing x on a parent folder blocks everything below it.
- File belongs to another user:
sudo chown <user>:<group> <path>or add the user to the group. - Script not executable:
chmod +x <file>. - SELinux/AppArmor can deny even when modes look fine:
ls -Z,sudo ausearch -m avc -ts recent.
Diagnose: what each part of the command does
namei -lowner, group and permissions of every folder on the way to <path>
df -h <path>; df -i <path>No space left on deviceOut of disk space or inodesWhat it means
ENOSPC: the filesystem has no free blocks or no free inodes left.
Usual causes & fixes
- Find big folders:
sudo du -xh --max-depth=1 <path> | sort -rh | head. - Deleted files still open:
sudo lsof -nP +L1(restart the process). - Docker:
docker system dfthen prune; journald:journalctl --vacuum-time=7d.
Diagnose: what each part of the command does
df -h <path>free space on the filesystem holding <path>df -i <path>free inodes: a disk can be "full" with millions of tiny files
- Find big folders:
sudo ss -tlnp | grep :<port>Connection refusedIs anything listening on that port?What it means
The host answered but nothing accepts connections on that port (or a firewall actively rejects).
Usual causes & fixes
- Service not running:
systemctl status <service>. - Listening only on 127.0.0.1, not 0.0.0.0 / the external IP.
- Wrong port in the client config.
Diagnose: what each part of the command does
ss -tlnpTCP listening sockets with numeric ports and process| grep :<port>only that port
- Service not running:
nc -zv -w 5 <host> <port>Connection timed outCan I reach the port at all?What it means
No answer at all: packets are dropped on the way.
Usual causes & fixes
- Firewall, security group or network ACL blocks the port.
- Wrong IP / host is down / routing problem (
traceroute <host>).
Diagnose: what each part of the command does
nc -zjust test the connection-vsay succeeded / timed out-w 5give up after 5 seconds
sudo lsof -i :<port>Address already in useWho holds the port?What it means
EADDRINUSE: another process is already bound to that port.
Usual causes & fixes
- Stop the other process or pick another port.
- Old instance still running (e.g. a previous container:
docker ps --filter publish=<port>).
Diagnose: what each part of the command does
lsof -i :<port>process that has that port open
getent hosts <hostname>Could not resolve hostDNS: does the name resolve?What it means
"Name or service not known" / "Temporary failure in name resolution": the hostname could not be turned into an IP.
Usual causes & fixes
- Typo, or a private name that only resolves inside a VPN/VPC.
- Broken resolver: check
cat /etc/resolv.conf, test withdig @8.8.8.8 <hostname>. - In Kubernetes use
<service>.<namespace>.svc.cluster.local.
Diagnose: what each part of the command does
getent hostsresolve the name the way the system does (/etc/hosts + DNS)
ulimit -n; grep "open files" /proc/<pid>/limitsToo many open filesCheck the open-files limitWhat it means
EMFILE: the process hit its maximum number of open file descriptors.
Usual causes & fixes
- Raise it for a service:
LimitNOFILE=65536in the systemd unit, thendaemon-reload+ restart. - A descriptor leak in the app (count them:
ls /proc/<pid>/fd | wc -l).
Diagnose: what each part of the command does
ulimit -nlimit for your current shell/proc/<pid>/limitsthe limits a running process actually has
- Raise it for a service:
findmnt -o TARGET,OPTIONS -T <path>Read-only file systemWhy is the disk read-only?What it means
The filesystem is mounted read-only, often remounted by the kernel after disk errors.
Usual causes & fixes
- Check kernel errors:
dmesg -T | grep -i -E "error|remount". - Containers: the image filesystem is read-only by design; write to a volume or /tmp.
Diagnose: what each part of the command does
findmnt -T <path>the mount that contains <path>-o TARGET,OPTIONSshow where it is mounted and its options (ro / rw)
- Check kernel errors:
ssh-keygen -R <host>Host key verification failedServer key changed: remove the old oneCautionWhat it means
The server's SSH host key differs from the one you saved: a rebuilt server, or a man-in-the-middle.
Usual causes & fixes
- Verify the new fingerprint out of band before reconnecting.
- Expected after recreating a VM with the same IP/name.
Diagnose: what each part of the command does
ssh-keygen -R <host>delete the saved key for <host> from ~/.ssh/known_hosts
ssh -v <user>@<host>Permission denied (publickey)SSH key rejected: see what ssh triesWhat it means
The server did not accept any of your keys.
Usual causes & fixes
- Wrong user (ubuntu vs ec2-user vs root) or wrong key:
ssh -i <key-file> <user>@<host>. - Permissions too open:
chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys ~/.ssh/id_ed25519(sshd StrictModes refuses group/world-writable files). - Public key not in the server's
~/.ssh/authorized_keys:ssh-copy-id <user>@<host>.
Diagnose: what each part of the command does
-vverbose: shows which keys are offered and why they are refused
- Wrong user (ubuntu vs ec2-user vs root) or wrong key:
Docker errors5
sudo usermod -aG docker $USER && newgrp dockerdocker.sock permission denied"permission denied while trying to connect to the Docker daemon socket"CautionWhat it means
Your user may not talk to /var/run/docker.sock.
Usual causes & fixes
- Note: the docker group is root-equivalent on that machine.
Diagnose: what each part of the command does
usermod -aG docker $USERadd yourself to the docker group&&thennewgrp dockerstart a shell with the new group (or log out and in)
sudo systemctl status dockerCannot connect to daemon"Cannot connect to the Docker daemon … Is the docker daemon running?"What it means
The client cannot reach dockerd.
Usual causes & fixes
- Start it:
sudo systemctl enable --now docker. - Wrong
DOCKER_HOSTor context:docker context ls.
Diagnose: what each part of the command does
systemctl status dockeris the Docker service running, and its last log lines
- Start it:
docker ps --filter publish=<port>port is already allocatedWhich container holds the host port?What it means
Another container (or process) already uses that host port.
Usual causes & fixes
- Stop/remove the other container, or map a different host port (
-p 8081:80). - Not a container?
sudo lsof -i :<port>.
Diagnose: what each part of the command does
--filter publish=<port>containers publishing that host port
- Stop/remove the other container, or map a different host port (
docker image inspect <image> --format '{{.Os}}/{{.Architecture}}'exec format errorImage built for another CPU architectureWhat it means
The binary in the image does not match the machine's CPU (e.g. an arm64 image on amd64), or a script lacks a shebang.
Usual causes & fixes
- Build for the target:
docker buildx build --platform linux/amd64,linux/arm64 …. - Script entrypoint: add
#!/bin/shas the first line.
Diagnose: what each part of the command does
image inspectimage metadata--format '{{.Os}}/{{.Architecture}}'e.g. linux/arm64 vs linux/amd64
- Build for the target:
docker logintoomanyrequestsDocker Hub pull rate limitWhat it means
Anonymous pulls from Docker Hub are rate-limited per IP.
Usual causes & fixes
- Log in (also on CI runners / nodes via imagePullSecrets).
- Use a pull-through cache or mirror the images to your own registry.
Diagnose: what each part of the command does
docker loginauthenticated pulls get a higher limit
Git, Terraform & Helm errors6
git pull --rebase origin <branch>rejected (non-fast-forward)"Updates were rejected because the remote contains work that you do not have"What it means
Someone pushed to the branch since you last pulled; a plain push would overwrite their work.
Usual causes & fixes
- Pull with rebase, resolve conflicts, then
git push. - Only after a deliberate rebase of your own branch:
git push --force-with-lease.
Diagnose: what each part of the command does
pull --rebasefetch the remote commits and replay yours on toporigin <branch>the branch you are pushing
- Pull with rebase, resolve conflicts, then
git diff --name-only --diff-filter=UCONFLICTMerge conflict: which files?What it means
Both sides changed the same lines; Git marked them with <<<<<<< ======= >>>>>>>.
Usual causes & fixes
- Edit the files, remove the markers,
git add <file>, thengit commit(orgit rebase --continue). - Give up:
git merge --abort/git rebase --abort.
Diagnose: what each part of the command does
--name-onlylist file names only--diff-filter=Uonly Unmerged (conflicted) files
- Edit the files, remove the markers,
git switch -c <new-branch>detached HEADKeep work done in detached HEADWhat it means
You checked out a commit or tag directly, not a branch. New commits belong to no branch.
Usual causes & fixes
- Already switched away? Find the commit in
git reflog.
Diagnose: what each part of the command does
switch -c <new-branch>create a branch at the current commit so the work is not lost
- Already switched away? Find the commit in
git rev-parse --show-toplevelnot a git repository"fatal: not a git repository"What it means
The current folder is not inside a Git working tree.
Usual causes & fixes
cdinto the repo, orgit init/git clonefirst.- In CI/containers: "dubious ownership" →
git config --global --add safe.directory <path>.
Diagnose: what each part of the command does
rev-parse --show-toplevelprint the repo root, or fail if you are not inside a repo
terraform force-unlock <lock-id>state lockTerraform "Error acquiring the state lock"DestructiveWhat it means
Another run holds the state lock, or a crashed/cancelled run left it behind.
Usual causes & fixes
- Make sure no other plan/apply is running first.
- Avoid by not cancelling apply jobs; use a CI concurrency group per workspace.
Diagnose: what each part of the command does
force-unlock <lock-id>remove the lock (ID is in the error message)
helm history <release> -n <namespace>another operation in progressHelm "another operation (install/upgrade/rollback) is in progress"What it means
A previous Helm operation was interrupted and left the release in a pending state.
Usual causes & fixes
- Roll back to the last deployed revision:
helm rollback <release> <revision> -n <namespace>. - Use
--rollback-on-failure(Helm 4) /--atomic(Helm 3) and a timeout so this cleans up itself.
Diagnose: what each part of the command does
history <release>revisions; the last one is stuck in pending-install / pending-upgrade
- Roll back to the last deployed revision:
Nothing matches.
My DevOps Playbook by Angelo John Calleja