chezmoi-troubleshooting
This skill should be used when the user encounters chezmoi failures, state issues, or configuration problems, such as when chezmoi doctor shows errors, scripts don't run as expected, chezmoi verify fails, chezmoi diff shows unexpected changes, state needs resetting, or merge conflicts occur in chezmoi source.
- License 许可
- MIT
- 最近更新
- 2026-08-03
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- chezmoi-troubleshooting
- description
- This skill should be used when the user encounters chezmoi failures, state issues, or configuration problems, such as when chezmoi doctor shows errors, scripts don't run as expected, chezmoi verify fails, chezmoi diff shows unexpected changes, state needs resetting, or merge conflicts occur in chezmoi source.
02 资源文件 2
- 参考文档SOURCE.md191 B
- 参考文档TRUST.auto.yaml2.2 KB
03 SKILL.md 正文
Chezmoi Troubleshooting
Systematic diagnostic workflows for chezmoi failures, state corruption, drift, and configuration problems.
Safety Constraints
SAFE operations only — never modify the system without user approval:
chezmoi doctor— Full diagnosticchezmoi state dump— View script execution statechezmoi diff— Preview what would changechezmoi verify— Check files match sourcechezmoi execute-template— Preview template outputchezmoi data— View template variables
FORBIDDEN without explicit approval: chezmoi apply, chezmoi update
1. Doctor Interpretation
Run chezmoi doctor and interpret the output:
| Check | Expected | Failure Meaning | Fix |
|---|---|---|---|
| version | latest | Outdated chezmoi | brew upgrade chezmoi |
| config-file | found path | Config missing | chezmoi init or create manually |
| source-dir | git working tree (clean) | Source dirty or not git | chezmoi cd && git status |
| git-command | found path | Git not in PATH | Install git via mise/brew |
| edit-command | found path | Editor not configured | Set $EDITOR or configure in chezmoi.toml |
| 1password | found path (optional) | op CLI missing | Only needed if using 1Password templates |
| age | found path (optional) | age not installed | Only needed if using age encryption |
| gpg | found path (optional) | gpg not found | Only needed if using GPG encryption |
Filter for problems only:
chezmoi doctor | grep -v "^ok"
Color codes: ok = green (pass), warning = yellow (optional), error = red (must fix)
2. State Management
Chezmoi tracks script execution in two state buckets:
| Bucket | Controls | When to Reset |
|---|---|---|
scriptState |
run_once_* scripts |
Script was fixed after failed first run |
entryState |
run_onchange_* scripts |
Script content hash mismatch |
View current state:
chezmoi state dump
Reset run_once state (scripts will re-run on next apply):
chezmoi state delete-bucket --bucket=scriptState
Reset run_onchange state (both run_once and run_onchange are in scriptState):
chezmoi state delete-bucket --bucket=scriptState
Note: entryState tracks managed FILE state, not scripts. Deleting entryState
would force a full re-apply of all managed files — use with extreme caution.
Common State Issues
run_once script doesn't run:
- Check if already executed:
chezmoi state dump | grep script_name - If state exists but script was fixed: reset scriptState bucket
- If template condition blocks it:
chezmoi execute-template < script.sh.tmpl
run_onchange runs every time:
- Check for non-deterministic template output (timestamps, random values)
- Verify data inputs are stable:
chezmoi data - Reset entryState and re-apply
3. Diff Debugging
Interpret diff output:
chezmoi diff # All changes
chezmoi diff ~/.zshrc # Single file
chezmoi diff --exclude=scripts # Skip scripts
chezmoi diff --include=files # Files only
Unexpected changes — common causes:
| Symptom | Cause | Debug Command |
|---|---|---|
| Template renders wrong | Syntax error | chezmoi execute-template < file.tmpl |
| Wrong variable value | Data mismatch | chezmoi data | grep variable_name |
| File appears modified | Local manual edit (drift) | chezmoi verify to confirm |
| Permission changes | Mode mismatch | Check source file prefix (executable_, private_) |
Debug template expansion:
# Preview what a template would render to
chezmoi execute-template < "$(chezmoi source-path)/dot_zshrc.tmpl"
# Compare with deployed file
diff <(chezmoi execute-template < "$(chezmoi source-path)/dot_zshrc.tmpl") ~/.zshrc
4. Merge Conflict Resolution
chezmoi cd # Enter source directory
git status # See conflicted files
git diff # Review conflicts
# Manually edit conflicted files
git add <resolved-files>
git commit -m "Resolve merge conflict"
# Then: chezmoi diff to verify, chezmoi apply to deploy
5. Version Compatibility
Enforce minimum version with .chezmoiversion:
2.40.0
Place in source root. Chezmoi will refuse to operate if version is too old.
Diagnostic Flowchart
- Start:
chezmoi doctor— any errors? Fix those first - Then:
chezmoi verify— any drift? Review withchezmoi diff - Then:
chezmoi state dump— any stuck scripts? Reset relevant bucket - Then:
chezmoi execute-template— template rendering correctly? - Still broken? Check
chezmoi datafor variable issues
Related Skills
- chezmoi-config — Template syntax and configuration reference
- chezmoi-workflows — Daily operations (prerequisite understanding)
- chezmoi-migration — Setup issues on new machines
- chezmoi-advanced-config — Encryption, git automation issues
04 同仓库更多 Skills
next-workflow-step
Use this skill when the user wants to transition to the next workflow step, wrap up a session cleanly, prepare a handoff, or says things like "next step", "continue the workflow", "wrap up", "hand off", "move to the next phase", "what's next in embrace", or "prepare for /clear". Also triggers when the current octo:embrace phase appears complete and no explicit next action is set.
source-discovery
This skill should be used when the user asks to "find sources", "discover URLs", "catalog a source", "classify a URL", "search for libraries", "check what exists", or mentions source discovery, URL cataloging, source classification, or research source management.
review-synthesis
This skill should be used when the user asks to "summarize review findings", "prioritize fixes", "rank review issues", "combine reviewer feedback", "create action items from review", or mentions review synthesis, finding prioritization, severity ranking, or review result summarization.
research-scoring
This skill should be used when the user asks to "score research", "check research quality", "evaluate coverage", "measure improvement", "assess research completeness", or mentions research scoring, quality metrics, coverage gaps, improvement baseline, or research pipeline status.
notebooklm-integration
This skill should be used when the user asks to "ingest into NotebookLM", "query NotebookLM", "add sources to notebook", "cross-source synthesis", "check stale sources", or mentions NotebookLM, notebook integration, source ingestion, or knowledge consolidation.
evidence-synthesis
This skill should be used when the user asks to "synthesize findings", "combine research", "cross-reference sources", "summarize evidence", "write a deep review", or mentions evidence synthesis, finding consolidation, cross-source analysis, or research summarization.