Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
openaec-foundation avatar

Frappe Agent Debugger

  • 1 installs
  • 159 repo stars
  • Updated July 8, 2026
  • openaec-foundation/erpnext_anthropic_claude_development_skill_package

Diagnoses Frappe/ERPNext errors with a structured workflow using bench console, traceback analysis, Error Log, pdb/DAP debugging, and profiling.

About

A debugging skill that provides a deterministic workflow for diagnosing Frappe/ERPNext errors using bench console, logs, and tracebacks. A developer uses it when hunting down a Frappe bug or reading log context instead of trial-and-error debugging.

  • Systematic error classification with targeted diagnosis checklists
  • Covers bench console, tracebacks, Error Log, pdb/VS Code DAP, profiling, Recorder

Frappe Agent Debugger by the numbers

  • 1 all-time installs (skills.sh)
  • Ranked #488 of 596 Debugging skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/openaec-foundation/erpnext_anthropic_claude_development_skill_package --skill frappe-agent-debugger

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1
repo stars159
Last updatedJuly 8, 2026
Repositoryopenaec-foundation/erpnext_anthropic_claude_development_skill_package

What it does

Diagnoses Frappe/ERPNext errors with a structured workflow using bench console, traceback analysis, Error Log, pdb/DAP debugging, and profiling.

Files

SKILL.mdMarkdownGitHub ↗

Frappe Debugging Agent

Systematically diagnoses Frappe/ERPNext issues by classifying errors, locating relevant code, and applying targeted diagnosis checklists.

Purpose: Eliminate trial-and-error debugging — follow a deterministic diagnostic workflow.

When to Use This Agent

ERROR ANALYSIS TRIGGER
|
+-- Python traceback or error message
|   "ImportError: cannot import name X from frappe"
|   --> USE THIS AGENT
|
+-- JavaScript console error
|   "Uncaught TypeError: frm.set_value is not a function"
|   --> USE THIS AGENT
|
+-- Silent failure (no error, wrong behavior)
|   "Server Script runs but nothing happens"
|   --> USE THIS AGENT
|
+-- Scheduler/background job failure
|   "Job X failed" in scheduler logs
|   --> USE THIS AGENT
|
+-- Build/asset errors
|   "Module not found" or blank page after build
|   --> USE THIS AGENT

Debugging Workflow

STEP 1: CLASSIFY ERROR TYPE
  Python | JavaScript | Database | Permission | Hook | Scheduler | Build

STEP 2: IDENTIFY THE MECHANISM
  Controller | Server Script | Client Script | Hook | Scheduler | API

STEP 3: LOCATE RELEVANT CODE
  Use Frappe file path conventions to find source

STEP 4: APPLY DIAGNOSIS CHECKLIST
  Run type-specific checklist for the error class

STEP 5: SUGGEST FIX
  Provide corrected code + reference relevant frappe-* skills

See references/workflow.md for detailed steps.

Step 1: Error Classification

Error TypeIndicatorsPrimary Tool
PythonTraceback with .py filesbench console, logs
JavaScriptBrowser console error, cur_frm issuesBrowser DevTools
DatabaseOperationalError, IntegrityErrorbench mariadb
Permissionfrappe.PermissionError, 403 responsesPermission Inspector
HookErrors after bench migrate, wrong eventsbench doctor
Schedulerbench doctor warnings, RQ failuresScheduler logs
BuildMissing assets, blank page, module errorsbench build --verbose

Step 2: Mechanism Identification

SymptomLikely Mechanism
Error during form save/submitController or Server Script (validate/on_submit)
Error on page loadClient Script or Web Template
Error message from API callWhitelisted method or REST API handler
Error in backgroundScheduler event or frappe.enqueue() job
Error after bench migrateHook configuration or patch
Error after bench buildFrontend asset pipeline

Step 3: File Path Conventions

ALWAYS check these locations based on the mechanism:

MechanismFile Path Pattern
Controllerapps/{app}/{app}/{module}/{doctype}/{doctype}.py
Server ScriptDesk > Server Script list (stored in DB)
Client ScriptDesk > Client Script list (stored in DB)
hooks.pyapps/{app}/{app}/hooks.py
Schedulerapps/{app}/{app}/tasks.py or hooks.py scheduler_events
Whitelistedapps/{app}/{app}/{module}/*.py (search for @frappe.whitelist)
Jinjaapps/{app}/{app}/templates/
Patchesapps/{app}/{app}/patches/

Step 4: Diagnosis Checklists (Quick Reference)

Python Errors

Error PatternLikely CauseFix
AttributeError: 'NoneType'frappe.get_doc() returned NoneCheck document exists first
ValidationErrorfrappe.throw() in validateRead the message — it IS the diagnosis
ImportErrorWrong import path or Server Script using importsServer Scripts CANNOT import
LinkValidationErrorReferenced document does not existVerify Link field target exists
TimestampMismatchErrorConcurrent edit conflictReload document before save
DuplicateEntryExceptionUnique constraint violationCheck naming series or unique fields
MandatoryErrorRequired field is emptySet field before save/submit
InvalidStatusErrorWrong docstatus transitionFollow 0→1→2 sequence
CircularLinkingErrorSelf-referencing parent-childFix document hierarchy

JavaScript Errors

Error PatternLikely CauseFix
frm.X is not a functionWrong API or stale codeClear cache, check API name
cur_frm is undefinedCode runs outside form contextUse frm from handler parameter
Uncaught PromiseMissing async/await on frappe.callAdd callback or await
field undefined in frm.docField does not exist on DocTypeCheck fieldname spelling
Form not refreshingMissing frm.refresh_fields()Add refresh after set_value

Database Errors

Error PatternLikely CauseFix
OperationalError: 1054Column does not existRun bench migrate
OperationalError: 1146Table does not existRun bench migrate
IntegrityError: 1062Duplicate primary keyCheck naming/autoname
IntegrityError: 1452Foreign key violationLinked document missing
OperationalError: 1213DeadlockReduce transaction scope
InternalError: 1366Invalid character for charsetCheck input encoding

Permission Errors

Error PatternLikely CauseFix
frappe.PermissionErrorUser lacks role permissionCheck Role Permission Manager
403 on API callMissing frappe.has_permission() or wrong @frappe.whitelist(allow_guest=True)Add permission check or guest flag
Empty list viewUser Permissions filteringCheck User Permission for that user
Cannot submitNo Submit permission for roleAdd Submit perm in DocType

Debug Tools

bench console (Python REPL)

bench --site {site} console
# Then:
frappe.get_doc("Sales Invoice", "SINV-00001")  # Inspect document
frappe.db.sql("SELECT name FROM `tabSales Invoice` LIMIT 5")  # Raw SQL
frappe.get_hooks("doc_events")  # Inspect active hooks
frappe.get_all("Server Script", filters={"disabled": 0}, fields=["name", "script_type"])

bench mariadb (SQL shell)

bench --site {site} mariadb
-- Then:
SHOW CREATE TABLE `tabSales Invoice`;
SELECT * FROM `tabError Log` ORDER BY creation DESC LIMIT 10;

bench doctor

bench doctor  # Check scheduler, workers, background jobs

frappe.logger()

logger = frappe.logger("my_debug", allow_site=True)
logger.info(f"Variable value: {my_var}")
# Logs to: sites/{site}/logs/my_debug.log

Browser DevTools

Console tab  → JavaScript errors
Network tab  → Failed API calls (check response body for traceback)
Application tab → Session/cookie issues

Log File Locations

LogPathContains
Frappe websites/{site}/logs/frappe.logWeb request errors
Workersites/{site}/logs/worker.logBackground job errors
Schedulersites/{site}/logs/scheduler.logScheduled task output
Custom loggersites/{site}/logs/{name}.logfrappe.logger("{name}") output
Bench~/.bench/logs/bench.logBench command output
Error Log DocTypeDesk > Error LogUI-accessible error records
Supervisor/var/log/supervisor/Process manager logs
nginx/var/log/nginx/HTTP request/proxy errors

Common Error Patterns Table

Error MessageLikely CauseFixRelevant Skill
Import not allowed in Server ScriptsUsing import in Server ScriptUse frappe.utils.* or move to Controllerfrappe-errors-serverscripts
Cannot read properties of undefinedJS accessing field before form loadAdd frm.doc.field null checkfrappe-errors-clientscripts
DocType X not foundMissing app install or migrationbench migrate or bench install-appfrappe-ops-bench
Scheduler is not runningWorkers stoppedbench doctor, restart workersfrappe-ops-bench
BrokenPipeErrorgunicorn timeout on long operationUse frappe.enqueue() for long tasksfrappe-impl-scheduler
ModuleNotFoundErrorPython package not installedbench pip install {pkg}frappe-ops-bench
Duplicate nameName collision in naming seriesCheck autoname or naming_seriesfrappe-syntax-doctypes
Insufficient PermissionMissing role for operationCheck Role Permissionsfrappe-core-permissions
Cannot edit submitted documentModifying docstatus=1 docUse amend_doc() or cancel firstfrappe-errors-controllers
Invalid columnSchema out of syncbench migratefrappe-errors-database

Agent Output Format

ALWAYS produce debugging output in this format:

## Debug Report

### Error Classification
**Type**: [Python/JS/Database/Permission/Hook/Scheduler/Build]
**Mechanism**: [Controller/Server Script/Client Script/Hook/etc.]

### Root Cause
[One-sentence diagnosis]

### Evidence
- [What log/traceback line confirms this]
- [What code path is involved]

### Fix
[Corrected code or configuration change]

### Verification Steps
1. [How to confirm the fix works]
2. [What to check in logs/UI]

### Referenced Skills
- `frappe-*`: [what was consulted]

Debugging Decision Tree

ERROR RECEIVED
|
+-- Has traceback?
|   +-- YES: Read LAST line first (actual error)
|   |   +-- Contains ".py" --> Python error (Step 4: Python checklist)
|   |   +-- Contains "SQL" --> Database error (Step 4: Database checklist)
|   +-- NO: Check browser console
|       +-- Has JS error --> JavaScript error (Step 4: JS checklist)
|       +-- No error visible --> Silent failure
|           +-- Check Error Log DocType
|           +-- Check frappe.log
|           +-- Add frappe.logger() statements
|
+-- Error after bench command?
|   +-- After migrate --> Hook/schema issue
|   +-- After build --> Frontend asset issue
|   +-- After update --> Version compatibility issue
|
+-- Intermittent error?
    +-- Check scheduler logs
    +-- Check worker logs
    +-- Check for race conditions (TimestampMismatchError)

See references/checklists.md for complete diagnosis checklists. See references/examples.md for debugging walkthrough examples. See references/advanced-debugging.md for VS Code DAP setup, bench console patterns, mariadb diagnostics, and profiling tools.

Related skills

Debuggingbackendtesting

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.