Developer tools dump stack traces, exit codes, and jargon. Figuring out *what to do next* often means searching the same Stack Overflow answers again.
Turn cryptic developer errors into actionable fixes.
Developer tools dump stack traces, exit codes, and jargon. Figuring out what to do next often means searching the same Stack Overflow answers again.
why-failed is a local-first CLI that reads an error message (from arguments, stdin, or a file), matches it against a curated rule database, and prints a short why / check / fix explanation.
It does not call OpenAI, Anthropic, Gemini, Ollama, or any other model. Version 1 is fully offline, deterministic, and works without API keys or network access.
pip install why-failed
Development install:
git clone <repo>
cd why-failed
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e ".[dev]"
# Direct text
why-failed "fatal: not a git repository"
# Multiple arguments (joined)
why-failed npm ERR! ERESOLVE unable to resolve dependency tree
# Pipe a failing command
npm install 2>&1 | why-failed
# Read a log file
why-failed --file error.log
# Explicit stdin
why-failed --stdin < build.log
# Machine-readable JSON
why-failed --json "ECONNREFUSED 127.0.0.1:6379"
# Only print the primary fix
why-failed --quiet "ECONNREFUSED 127.0.0.1:6379"
# Show score / alternatives
why-failed --verbose "ECONNREFUSED 127.0.0.1:6379"
# List rules
why-failed --list-rules
| Code | Meaning |
|---|---|
| 0 | Successful analysis (rule matched) |
| 1 | Input / runtime error |
| 2 | No matching rule |
A failed original command does not force a non-zero exit — this tool analyzes failures.
Before:
Error: connect ECONNREFUSED 127.0.0.1:6379
After:
✗ Redis connection failed
WHY
The application tried to connect to Redis, but the connection was refused.
CHECK
→ Is Redis running?
→ Is port 6379 listening?
→ Is REDIS_URL correct?
FIX
1. docker compose up -d redis
2. Check REDIS_URL
3. Check whether port 6379 is exposed
Confidence: High
| Tool | Rules |
|---|---|
| Git | 12 |
| npm | 9 |
| Node | 7 |
| Python | 11 |
| Docker | 10 |
| TypeScript | 9 |
| MongoDB | 6 |
| Redis | 6 |
| Linux | 9 |
| Total | 79 |
Input
↓
Normalizer (ANSI strip, CRLF, secrets, size limit)
↓
Matcher (deterministic scoring)
↓
Rule Registry
↓
Structured Result
↓
Terminal / JSON
An ErrorProvider protocol exists so an optional AI provider can be added later without rewriting the core pipeline. V1 ships only the local rules provider.
No network requests.
No command execution.
Secrets are redacted before display.
--file PATHSee CONTRIBUTING.md for setup, tests, and how to add a rule.
Quick rule sketch:
Rule(
id="docker.port_allocated",
tool="docker",
title="Port is already allocated",
why="Docker could not bind a published port because another process already uses it.",
checks=("Is another container using that host port?",),
fixes=("docker ps",),
patterns=(Pattern(r"port is already allocated", kind="regex", required=True),),
confidence="high",
)
Possible future features (not in v1):
MIT — see LICENSE.