Developer tools dump stack traces, exit codes, and jargon. Figuring out *what to do next* often means searching the same Stack Overflow answers again.
Thanks for helping improve local, deterministic error explanations.
Requires Python 3.11+.
python -m venv .venv
# Windows:
.venv\Scripts\activate
# macOS / Linux:
source .venv/bin/activate
pip install -e ".[dev]"
pytest
pytest --cov=why_failed --cov-report=term-missing
ruff check .
mypy src
src/why_failed/rules/ (e.g. git.py).Rule(...) to the module's RULES list.why / checks / fixes short and actionable.tests/rules/test_<tool>.py.Rule(
id="redis.connection_refused",
tool="redis",
title="Redis connection failed",
why="The application tried to connect to Redis, but the connection was refused.",
checks=(
"Is Redis running?",
"Is port 6379 listening?",
"Is REDIS_URL correct?",
),
fixes=(
"docker compose up -d redis",
),
patterns=(
Pattern("ECONNREFUSED", kind="exact", required=True),
Pattern("6379", kind="exact", required=True),
),
confidence="high",
secondary=("redis",),
)
| Kind | Default score | Use for |
|---|---|---|
exact | 5 | Unique literal fragments |
regex | 3 | Structured codes / variants |
tool | 2 | Tool name signal |
generic | 1 | Weak supporting context |
Mark decisive signals with required=True.
why-failed "your error text here"
why-failed --verbose "your error text here"
why-failed --json "your error text here"
pytest tests/rules/test_redis.py -q
src/eval / exec