This prompt is designed for support engineers and platform teams who need to transform a static, flat catalog of error codes into an interactive, branching diagnostic flow. The core job-to-be-done is converting a reference list—where each entry is an isolated error—into a navigable decision tree that guides a user or an automated system from a symptom to a specific root cause and resolution. The ideal user has a complete or near-complete error code catalog and needs a structured troubleshooting script that can be used by Tier 1 support agents, embedded into a support chatbot, or integrated into a runbook automation system. The required context includes the full list of error codes, their descriptions, and any known common causes or diagnostic commands.
Prompt
Troubleshooting Decision Tree Prompt

When to Use This Prompt
Defines the ideal scenario, required inputs, and boundaries for the Troubleshooting Decision Tree Prompt.
You should use this prompt when the error catalog is large enough that a simple lookup table is insufficient, typically more than 20-30 distinct error codes with overlapping symptoms. The prompt excels at identifying shared diagnostic checkpoints—such as 'verify network connectivity' or 'check configuration file syntax'—that can be reused across multiple branches, reducing redundancy in the final script. It also includes a critical coverage validation step: the prompt instructs the model to verify that every single error code from the input catalog appears in at least one terminal resolution leaf. This prevents orphaned errors that would otherwise be unreachable in the decision tree. The output is a structured tree with three node types: branching questions (yes/no or multiple-choice), diagnostic checkpoints (commands to run or states to verify), and terminal resolution leaves (mapped to specific error codes with fix steps).
Do not use this prompt when you need a simple error code lookup table or a flat FAQ. If your error catalog has fewer than 10 codes with no overlapping symptoms, a decision tree adds unnecessary complexity. Similarly, avoid this prompt when the error codes lack sufficient diagnostic context—if you cannot describe what conditions lead to each error, the model cannot infer meaningful branching logic. For high-risk production systems where an incorrect diagnostic path could trigger destructive actions (like database resets or traffic rerouting), you must add a human review gate after generation and before deployment. The prompt produces a troubleshooting guide, not a verified runbook; always have a subject-matter expert validate the diagnostic commands and resolution steps before they reach production.
Use Case Fit
Where the Troubleshooting Decision Tree prompt delivers reliable diagnostic flows and where it introduces operational risk.
Good Fit: Closed Diagnostic Domains
Use when: the error space is bounded and known, such as a documented API error catalog, a hardware device with enumerated fault codes, or a software product with a finite set of failure states. The decision tree can exhaustively branch from symptom to root cause without encountering novel, unclassifiable inputs. Guardrail: validate that every terminal error code in your catalog maps to at least one resolution leaf before deploying the prompt.
Bad Fit: Open-Ended or Novel Failures
Avoid when: the system encounters previously unseen errors, multi-cause cascading failures, or infrastructure incidents where the root cause is not in a pre-defined catalog. The decision tree will force-fit novel failures into existing branches, producing confident but incorrect diagnoses. Guardrail: implement an 'unclassified' escape hatch that escalates to a human with the full diagnostic trace rather than guessing.
Required Inputs: Complete Error Surface
Risk: an incomplete error code catalog produces dead-end branches where the tree cannot reach a resolution leaf, leaving the user stranded. Guardrail: require a structured error catalog as input with at minimum error code, HTTP status, message pattern, common causes, and resolution steps. Run a coverage check that every catalog entry appears in at least one decision path before releasing the prompt.
Operational Risk: Diagnostic Side Effects
Risk: the decision tree may instruct users to run diagnostic commands, check logs, or modify configuration as part of branching logic. In production systems, some diagnostic steps are read-only and safe, while others can impact performance or state. Guardrail: tag every diagnostic checkpoint with a safety level (safe/risky/destructive) and require explicit confirmation before any step that modifies state or queries production databases at scale.
Operational Risk: Stale Resolution Paths
Risk: as the underlying system evolves, error codes are added, deprecated, or change semantics. A decision tree prompt frozen at build time will route users to outdated or incorrect resolution steps. Guardrail: version the decision tree prompt alongside the error catalog it references. Run a periodic reconciliation check that flags any error code in the live catalog that is missing from the current tree version.
Boundary: When to Use Product Code Instead
Risk: a prompt-based decision tree adds latency and non-determinism to a problem that may be solvable with a deterministic rule engine. If your error catalog is small and the branching logic is purely conditional on error codes and status fields, a hardcoded decision table in application code is faster, cheaper, and fully predictable. Guardrail: use the prompt-based tree when diagnostic questions require natural language reasoning over log messages, stack traces, or user-described symptoms that resist simple pattern matching.
Copy-Ready Prompt Template
A reusable prompt template for generating a troubleshooting decision tree from an error code catalog.
This prompt template is designed to transform a structured list of error codes into an interactive diagnostic decision tree. The model acts as a support engineering architect, building a branching logic flow that starts from a reported error code and guides a technician through diagnostic checkpoints to a terminal resolution leaf. The template uses square-bracket placeholders that you must replace with your specific error catalog, output format requirements, and operational constraints before sending it to the model.
markdownYou are a senior support engineer designing an interactive diagnostic decision tree for a production API. Your task is to convert the provided error code catalog into a branching troubleshooting flow that a support technician can follow step-by-step. ## INPUT ERROR CATALOG [ERROR_CATALOG] ## OUTPUT SCHEMA Produce a decision tree in [OUTPUT_FORMAT] format. Each node must be one of: - `question`: A diagnostic question with a set of `branches` keyed by possible answers. - `checkpoint`: A verification step that produces a pass/fail result, with `pass_branch` and `fail_branch`. - `resolution`: A terminal leaf containing the root cause summary and numbered resolution steps. ## CONSTRAINTS - Every error code in [ERROR_CATALOG] must map to at least one resolution leaf. - Include prerequisite checks (e.g., "Verify authentication token is valid") before deeper diagnostics. - For any resolution step that is destructive or irreversible (e.g., "drop and recreate the index"), prefix it with `[CONFIRM]` and require explicit user confirmation. - For errors related to rate limiting (HTTP 429), include a branch that checks the `Retry-After` header and calculates a backoff. - If a diagnostic path cannot reach a resolution, terminate at a `resolution` node that instructs the technician to escalate with a specific summary of findings. - Do not invent error codes or resolution steps not present in [ERROR_CATALOG]. ## EXAMPLES [FEW_SHOT_EXAMPLES] ## RISK LEVEL [RISK_LEVEL] Generate the complete decision tree now.
To adapt this template, start by populating [ERROR_CATALOG] with your structured error data—typically a JSON array of objects containing code, http_status, message, and known_causes. Choose an [OUTPUT_FORMAT] such as JSON, YAML, or Mermaid.js for diagram rendering. The [FEW_SHOT_EXAMPLES] placeholder should contain one or two complete branches demonstrating the expected node structure and depth. Set [RISK_LEVEL] to low, medium, or high to control how aggressively the model requires confirmation gates. After generating the tree, validate coverage by scripting a check that every error code in your input catalog appears in at least one resolution leaf. For high-risk production environments, route the generated tree through a human review step before embedding it in a runbook or support tool.
Prompt Variables
Inputs the prompt needs to build a reliable decision tree. Validate each before sending to avoid incomplete or hallucinated diagnostic paths.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[ERROR_CODE] | The specific error code to diagnose | ERR_TIMEOUT_504 | Must match the canonical error code format. Reject if empty or not found in the error catalog. |
[ERROR_CATALOG] | Complete reference of known error codes, causes, and resolutions | JSON array of error objects with code, cause, resolution fields | Schema check: must include code, cause, and resolution fields. Reject if catalog is empty or missing required fields. |
[SYMPTOM_DESCRIPTION] | User-reported symptoms or log output observed | Gateway timeout after 30s, upstream unreachable | Null allowed if no symptoms provided. If present, must be non-empty string. Truncate to 2000 characters. |
[SYSTEM_CONTEXT] | Runtime environment details where the error occurred | Service: api-gateway, Region: us-east-1, Version: 2.4.1 | Must include service name and environment. Reject if missing service identifier. Null allowed for offline diagnosis. |
[MAX_DEPTH] | Maximum depth of the decision tree before forcing a terminal node | 5 | Must be integer between 3 and 10. Default to 5 if not provided. Prevents infinite branching. |
[REQUIRED_COVERAGE] | Minimum percentage of error codes that must map to at least one resolution path | 95 | Must be integer between 80 and 100. Default to 95. Used in coverage validation step. |
[OUTPUT_FORMAT] | Desired output structure for the decision tree | Mermaid flowchart syntax | Must be one of: Mermaid, JSON tree, indented text. Default to Mermaid. Reject unsupported formats. |
Implementation Harness Notes
How to wire the troubleshooting decision tree prompt into a support tool or diagnostic workflow.
The troubleshooting decision tree prompt is designed to be called programmatically from a support engineer's diagnostic console or an automated triage pipeline. It accepts a structured input payload containing the error code, observed symptoms, and system context, and returns a complete decision tree in a machine-readable format. The primary integration point is a backend service that receives an error event, enriches it with relevant telemetry, and invokes the LLM with this prompt to generate an interactive diagnostic path. This is not a chat interface; it is a batch generation call that produces a static tree which the frontend then renders as a step-by-step troubleshooting flow.
To wire this into an application, wrap the prompt in a function that constructs the [ERROR_CATALOG], [SYMPTOMS], and [SYSTEM_CONTEXT] placeholders from live data sources. The error catalog should be pulled from your API gateway's error registry or an OpenAPI spec parser. Symptoms should be extracted from log aggregators, APM traces, or user-reported descriptions. System context—such as service versions, region, and recent deployments—should come from your infrastructure metadata store. Before calling the model, validate that every error code in the input has at least one known resolution path in your runbook database; if not, flag it for human triage instead of generating a potentially hallucinated tree. After receiving the model output, run a structural validator that checks: (1) the JSON conforms to the expected schema with error_code, branches, and terminal_leaves keys; (2) every branch question has at least two answer options; (3) every leaf node contains a non-empty resolution_steps array; and (4) the tree depth does not exceed a configurable maximum to prevent infinite loops. If validation fails, retry once with the validation errors appended to the [CONSTRAINTS] field, then escalate to a human reviewer on the second failure.
For production deployment, use a model with strong structured output capabilities and low latency, such as Claude 3.5 Sonnet or GPT-4o with JSON mode enabled. Set temperature to 0 or a very low value to maximize determinism. Log every generated tree alongside the input context, validation results, and the support engineer's eventual resolution path to build a feedback corpus. This corpus enables periodic evaluation: sample 100 trees per week, have senior support engineers rate them on diagnostic accuracy and actionability, and track the percentage of trees where the engineer followed the generated path to successful resolution. If the success rate drops below a defined threshold, trigger a prompt review cycle. Avoid using this prompt for error codes classified as security-sensitive, where exposing diagnostic logic could aid an attacker; route those to a human-only queue. Finally, implement a feedback button in the diagnostic console that lets engineers flag incorrect branches or missing resolution steps, feeding that signal directly into your prompt improvement backlog.
Expected Output Contract
Validate the structure of the generated decision tree before wiring it into a diagnostic harness. Each row defines a required field, its type, and a concrete validation rule that can be checked programmatically or manually.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
decision_tree | JSON Object | Top-level key must exist and be a non-empty object. Parse check: valid JSON. | |
decision_tree.tree_id | String | Must match pattern ^dt-[a-z0-9]+$. Uniqueness check against existing tree IDs in the system. | |
decision_tree.root_node_id | String | Must reference a valid node_id present in decision_tree.nodes. Reference integrity check. | |
decision_tree.nodes | Array of Objects | Array must contain at least 2 nodes. Schema check: every node must have node_id, type, and label. | |
decision_tree.nodes[].type | Enum: question | diagnostic | resolution | Must be one of the allowed enum values. Enum check: reject unknown types. | |
decision_tree.nodes[].branches | Array of Objects | Required when type is question. Each branch must have a target_node_id that resolves to an existing node. Null allowed for resolution nodes. | |
decision_tree.coverage_map | Object mapping error_code to node_id | Every error_code in [ERROR_CODE_LIST] must map to exactly one node_id. Completeness check: no unmapped error codes. | |
decision_tree.metadata.generated_at | ISO 8601 Timestamp | Must be a valid ISO 8601 string within the last 24 hours. Freshness check: reject timestamps older than 24 hours. |
Common Failure Modes
What breaks first when generating troubleshooting decision trees and how to guard against it.
Orphaned Error Codes
What to watch: The model generates a decision tree that skips error codes present in the input catalog, leaving them with no diagnostic path. This happens when the prompt doesn't enforce full coverage or the model truncates long catalogs. Guardrail: Require a pre-generation coverage checklist and post-generation diff against the input error code list. Flag any error code that doesn't appear in at least one leaf node.
Infinite Diagnostic Loops
What to watch: The tree contains cycles where question A leads to question B, which leads back to question A without resolution. This occurs when branching logic is generated without termination validation. Guardrail: Parse the generated tree into a directed graph and check for cycles programmatically. Add a hard constraint in the prompt that every branch must reach a terminal resolution leaf within a maximum depth.
Ambiguous Branching Questions
What to watch: Diagnostic questions that can't be answered definitively with available data, such as 'Is the network stable?' without defining stability. This forces support engineers to guess, breaking the decision tree's reliability. Guardrail: Require every branching question to reference an observable, measurable condition. Include a 'Cannot Determine' branch that escalates to a human or requests specific diagnostic data.
Missing Resolution Steps
What to watch: Terminal leaves that identify a root cause but provide no actionable remediation, leaving the support engineer with a diagnosis and no fix. This happens when the prompt emphasizes classification over resolution. Guardrail: Require every terminal leaf to include a structured resolution block with prerequisite checks, step-by-step actions, and a verification step. Validate that no leaf node lacks a resolution block.
Destructive or Irreversible Actions
What to watch: Resolution steps that recommend destructive actions like database deletions, cache purges, or production restarts without warnings, confirmation gates, or rollback instructions. Guardrail: Add a safety classifier that flags resolution steps containing destructive verbs. Require human approval for any step marked as destructive, and include rollback procedures in the resolution block.
Context Window Truncation
What to watch: Large error code catalogs exceed the model's context window, causing the tree to be silently truncated mid-generation with missing branches and incomplete leaves. Guardrail: Chunk large error catalogs by domain or severity tier and generate subtrees independently. Validate that the combined output has a terminal leaf for every input error code and no dangling branch references.
Evaluation Rubric
Score each criterion on a pass/fail or 1-5 scale before shipping the troubleshooting decision tree prompt. Use this rubric to validate that the generated tree is complete, safe, and actionable.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Error Code Coverage | Every error code in [ERROR_CATALOG] maps to at least one resolution leaf | Orphaned error codes with no path to a terminal node | Parse tree structure and diff leaf error codes against input catalog |
Branching Question Safety | No diagnostic question suggests destructive or irreversible actions without confirmation | Question contains commands like 'delete', 'drop', 'rm -rf', or 'format' without a warning gate | Regex scan for destructive verbs; manual review of all diagnostic checkpoints |
Terminal Resolution Actionability | Every terminal leaf contains a specific, ordered sequence of remediation steps | Leaf contains vague advice like 'check your configuration' or 'contact support' without diagnostic context | LLM-as-judge evaluation against a 1-5 specificity scale; require score >= 4 |
Decision Tree Determinism | Identical inputs produce the same path; no contradictory branches from the same condition | Two sibling branches have overlapping or identical conditions | Unit test with fixed [ERROR_CONTEXT] inputs; assert single unique path traversal |
Evidence Grounding | Every resolution step references a source document, runbook, or known fix | Steps contain invented commands, URLs, or configuration keys not present in [KNOWLEDGE_BASE] | Citation extraction and cross-reference check against provided source documents |
Escalation Gate Presence | Tree includes an explicit escalation path when confidence is low or resolution fails | No branch leads to a human escalation or 'stop and review' node after a failed fix attempt | Traverse all paths; confirm at least one escalation leaf exists and is reachable from every non-terminal node |
Output Schema Compliance | Generated tree matches [OUTPUT_SCHEMA] exactly with all required fields present | Missing 'condition', 'children', or 'resolution' fields; malformed JSON structure | Schema validation against the defined JSON Schema; reject on any validation errors |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Use the base prompt with a single model call and lighter validation. Accept the raw decision tree output without enforcing strict schema checks. Focus on getting a workable tree for 3-5 error codes before scaling.
Prompt modification
- Remove or relax the
[OUTPUT_SCHEMA]constraint; accept markdown or bulleted trees. - Reduce
[COVERAGE_TARGET]to a small subset of error codes. - Add:
If you are uncertain about a branch, mark it with [NEEDS_REVIEW] and continue.
Watch for
- Missing schema checks leading to inconsistent tree shapes
- Overly broad diagnostic questions that don't narrow the problem space
- Terminal leaves without actionable resolution steps
- Branches that loop back to earlier questions without progress

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us