This example demonstrates the new error reporting and diagnostic features added to taskfile:
The Taskfile uses placeholder patterns that will be detected:
ssh_host: ${STAGING_HOST:-staging.example.com} # ⚠️ Will warn about placeholder
ssh_host: ${PROD_HOST:-your-server.example.com} # ⚠️ Placeholder pattern detected!Run taskfile doctor to see placeholder warnings with --teach for explanations.
Preview what will happen without executing:
taskfile run deploy --env staging --explainSee educational explanations of @local/@remote behavior:
taskfile run deploy --env local --teachThe deploy task demonstrates environment-specific command filtering:
tasks:
deploy:
cmds:
- "@local docker compose build" # Skipped on remote envs (with message)
- "@remote docker compose up -d" # Skipped on local envs (with message)You'll see explicit skip messages like:
⏭ Pominięto @local (env 'staging' jest zdalny — ma ssh_host)⏭ Pominięto @remote (env 'local' nie ma ssh_host)
When commands fail, you get contextual diagnosis:
taskfile run build # If scripts/build.sh is missingShows:
- Clear error category (Config vs Runtime vs External)
- Root cause analysis
- Fix suggestions with commands
- Educational explanation of the underlying concept
Run with educational mode:
taskfile doctor --teachOutput shows 3 layers:
- ⚙️ Konfiguracja - Taskfile.yml issues, missing files, placeholders
- 📦 Zależności - Missing tools (docker, ssh, etc.)
- 🔧 Runtime - Port conflicts, SSH issues, disk space
Each issue includes a teach explanation when --teach is used.
cd examples/enhanced-error-reporting
taskfile doctor --teachYou'll see:
- Placeholder warnings for
your-server.example.com - Missing
.env.*file warnings - Missing
scripts/build.shwarning
taskfile run deploy --explainShows:
- Which commands will run for current env
- Which will be skipped (@local/@remote filtering)
- Dependencies in execution order
taskfile run deploy --teachExplains:
- What @local means (only runs when env has NO ssh_host)
- What @remote means (only runs when env HAS ssh_host)
- Which commands run in which environments
# Create missing files
cp .env.example .env.local 2>/dev/null || echo "APP_NAME=myapp" > .env.local
mkdir -p scripts
echo '#!/bin/bash\necho "Building..."' > scripts/build.sh
# Re-run doctor - should have fewer issues
taskfile doctorAll these checks now include educational explanations:
| Check | Issue | teach Explanation |
|---|---|---|
check_preflight |
Missing python3, git, ssh | Why each tool is needed |
check_ssh_keys |
No ~/.ssh or keys | SSH authentication basics |
check_ssh_connectivity |
Connection refused, auth failed | SSH debugging steps |
check_ports |
Port in use | How port binding works |
check_placeholder_values |
example.com, changeme, etc. | What placeholders are |
check_git |
Not a git repo | Why version control matters |
check_dependent_files |
Missing script | script: vs cmds: difference |
After an error, the user knows in 5 seconds what went wrong, if it's config or bug, and how to fix it.
Try running a task that will fail:
taskfile run build # Will fail - scripts/build.sh doesn't existThe error output will show:
- What: Script not found
- Why: The 'script:' directive requires an external file
- Fix: Create the file OR use 'cmds:' with inline commands
- Learn: Difference between script: and cmds: approaches