openaec-foundation/frappe_claude_skill_package/frappe-errors-controllers
Claude Code and agent skill by openaec-foundation/frappe_claude_skill_package
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Use when debugging or preventing errors in Frappe Document Controllers. Prevents autoname failures, validate loops, on_submit without is_submittable, wrong lifecycle hook choice, get_list permission errors, NestedSet errors, extend_doctype_class conflicts, missing super() calls, and recursion without flags. Covers error diagnosis by lifecycle phase for v14/v15/v16. Keywords: controller error, autoname, validate loop, on_submit, is_submittable,, save fails, validate error, on_submit not working, autoname broken, controller crash. get_list, NestedSet, extend_doctype_class, super, flags, recursion guard.
Install
npx vskill@latest install openaec-foundation/frappe_claude_skill_package/frappe-errors-controllersSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as openaec-foundation/frappe_claude_skill_package/frappe-errors-controllers.
Controller Errors — Diagnosis and Resolution
Cross-refs: frappe-syntax-controllers (syntax), frappe-impl-controllers (workflows), frappe-errors-serverscripts (server scripts).
Error Diagnosis by Lifecycle Phase
Error Message → Cause → Fix Table
| Error Message | Cause | Fix | |
|---|---|---|---|
NamingSeries is not set | DocType uses naming_series but field is missing | Add naming_series field to DocType or set autoname in controller | |
DuplicateEntryError | autoname generated non-unique name | Use naming_series with counter, or add hash suffix | |
Maximum recursion depth exceeded | self.save() called in validate/on_update | NEVER call self.save() in hooks; use self.db_set() in on_update | |
Not allowed to submit | DocType lacks is_submittable = 1 | Enable "Is Submittable" in DocType settings | |
Cannot cancel: linked docs exist | Submitted linked documents block cancellation | Cancel linked docs first, or use before_cancel to check | |
AttributeError: super() | Missing super() call in overridden hook | ALWAYS call super().method_name() first in overrides | |
Value missing for: field | Controller validate skipped parent logic | Ensure super().validate() is called | |
frappe.db.commit() breaks transactions | Manual commit in controller hook | NEVER call frappe.db.commit() in controllers | |
Changes lost in on_update | Set self.field = x instead of self.db_set() | Use self.db_set("field", value) after save hooks | |
NestedSet: root cannot be child | Parent set to itself or circular reference | Validate parent != self in validate, check lft/rgt | |
extend_doctype_class conflict [v16+] | Multiple apps extend same class with conflicting methods | Use MRO-aware design, check method resolution order | |
has_permission returns wrong result | Function returns None instead of True/False | ALWAYS return explicit True or False | |
permission_query_conditions SQL error | Malformed WHERE clause fragment | Test conditions string independently, use frappe.db.escape() |
Critical Error Patterns
1. Autoname Failures
Autoname options: naming_series, field:fieldname, format:PREFIX-{fieldname}-.####, hash, Prompt, or custom autoname() method.
2. Validate Loop: self.save() in Hooks
3. on_submit Without is_submittable
4. Wrong Lifecycle Hook: Error Timing
Transaction Rollback Rules by Hook:
| Hook | frappe.throw() Effect | |
|---|---|---|
validate / before_save | Full rollback — document NOT saved | |
before_submit | Full rollback — stays Draft | |
before_cancel | Full rollback — stays Submitted | |
on_update / after_insert | Document IS saved — error shown but doc persists | |
on_submit | docstatus = 1 — error shown but ALREADY submitted | |
on_cancel | docstatus = 2 — error shown but ALREADY cancelled |
5. Missing super() in Overrides
6. extend_doctype_class [v16+]
Resolution order: class ExtendedSalesOrder(Mixin2, Mixin1, OriginalSalesOrder) — last mixin listed has highest priority.
7. Flags for Recursion Guard
8. get_list Permission Errors
Note: permission_query_conditions affects frappe.db.get_list() only, NOT frappe.db.get_all().
9. NestedSet Errors
on_cancel: Isolate Cleanup Operations
ALWAYS / NEVER Rules
ALWAYS
- Call `super().method()` in overridden hooks — Preserve parent logic
- Validate in `before_submit` not
on_submit— Last clean abort point - Use `self.db_set()` in `on_update` — Direct
self.field = xis lost - Use `self.flags` for recursion guards — Prevent circular hook triggers
- Isolate cleanup operations in `on_cancel` — Don't let one failure stop all
- Use `frappe.db.escape()` in permission queries — Prevent SQL injection
- Return explicit True/False from `has_permission` — None falls back to default
- Use `frappe.log_error()` for unexpected exceptions — Never swallow silently
- Use `_()` wrapper for all user-facing error messages — Enable translation
NEVER
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/source/errors/frappe-errors-controllers/SKILL.md
Popularity
- Repository stars
- 91
- Repository forks
- 26
- 7-day trend score
- 23
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 30 Apr 2026, 7 months ago.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/openaec-foundation/frappe_claude_skill_package/frappe-errors-controllers)