This prompt is designed for QA engineers, support-to-engineering triage teams, and on-call developers who need to extract structured environment information from freeform bug reports. Users often describe their setup inconsistently: 'latest Chrome on Windows,' 'iPhone 15 with iOS 17.something,' or 'the app crashed on my laptop.' This prompt converts that noise into a predictable JSON block with explicit 'unknown' markers for missing fields, so downstream routing and reproduction logic never guesses. Use it when environment details are scattered across paragraphs, when you need to feed structured data into a ticketing system or test harness, or when you are building an automated triage pipeline that must decide whether a bug is platform-specific before a human looks at it.
Prompt
Bug Report Environment Details Extraction Prompt

When to Use This Prompt
Understand the ideal job-to-be-done, user, and context for the Environment Details Extraction Prompt, and recognize when it should not be used.
The ideal input is a raw, unstructured bug report that may contain environment clues in the title, description, or attached log snippets. The prompt works best when you provide a clear [OUTPUT_SCHEMA] defining the exact fields you need (e.g., os, os_version, browser, browser_version, device_type, app_version). You should also supply [CONSTRAINTS] such as 'Mark any field not found in the text as "unknown"' and 'Do not infer versions from generic terms like "latest."' For high-stakes triage pipelines, pair this prompt with a validation step that checks extraction accuracy against a set of manually labeled reports and flags any output where critical fields remain unknown for human review.
Do not use this prompt when the bug report already contains a structured environment block from a form submission, as direct parsing is more reliable. Avoid it for reports where environment details are entirely absent and you need the model to ask clarifying questions rather than extract. This prompt is also not a replacement for client-side telemetry or automated environment capture; it is a normalization layer for human-written text. If your workflow requires legal or compliance-grade audit trails for environment data, ensure a human reviews any extraction where the confidence is not explicitly high, and log the raw input alongside the structured output.
Use Case Fit
Where the Bug Report Environment Details Extraction Prompt works, where it fails, and the operational preconditions required before wiring it into a production triage pipeline.
Good Fit: Structured Triage Pipelines
Use when: you have a high volume of unstructured bug reports (emails, chatbots, forms) that must be normalized into a structured environment block before routing. Guardrail: the prompt output should feed directly into a downstream JSON schema validator, not a human-readable summary.
Bad Fit: Ambiguous or Sparse Reports
Avoid when: the input text contains no environment signals (e.g., 'the app is broken'). Guardrail: implement a pre-check that measures input entropy or keyword density. If no OS, browser, or version tokens are detected, bypass the prompt and return an 'unknown' block immediately to avoid hallucinated fields.
Required Inputs: Raw Text and a Strict Schema
What you need: the raw, uncleaned user report string and a predefined output schema with explicit 'unknown' defaults. Guardrail: never pass the prompt without the schema definition in context. The model must know that null or guessed values are unacceptable and that 'unknown' is the only valid fallback for missing data.
Operational Risk: Version Format Drift
Risk: users report versions inconsistently ('latest', 'new Mac', 'iOS 17'), causing extraction failures or normalization errors. Guardrail: add a post-extraction normalization step that maps colloquial strings to canonical identifiers using a maintained version map. Log unmapped values for manual review.
Operational Risk: Multi-Device Confusion
Risk: a single report mentions multiple devices (phone, desktop, tablet), and the prompt incorrectly merges fields into one hybrid environment. Guardrail: instruct the prompt to extract only the primary affected environment or to output an array of environment objects if ambiguity is detected. Validate that OS and browser fields are compatible.
Operational Risk: Silent Extraction Failures
Risk: the prompt returns a valid JSON structure but with incorrect values (e.g., 'Windows 11' extracted as 'Windows 10'), passing schema validation while corrupting triage data. Guardrail: run periodic accuracy evals against a golden set of manually labeled reports. Track precision and recall per field, and trigger a review if extraction accuracy drops below a defined threshold.
Copy-Ready Prompt Template
A copy-ready prompt for extracting structured environment details from unstructured bug reports, with explicit 'unknown' markers for missing fields.
This prompt template is designed to be pasted directly into your system instructions or as a user message in your triage pipeline. It instructs the model to parse a freeform bug report and extract key environment details—such as OS, browser, app version, and device—into a strict JSON schema. The critical design choice is the requirement for explicit unknown markers for any field not found in the source text, which prevents silent null failures and makes downstream validation deterministic.
textYou are an expert bug triage assistant. Your task is to extract environment details from the following bug report and output them in a strict JSON format. INPUT BUG REPORT: [INPUT] OUTPUT SCHEMA: { "operating_system": "string | 'unknown'", "os_version": "string | 'unknown'", "browser": "string | 'unknown'", "browser_version": "string | 'unknown'", "application_version": "string | 'unknown'", "device_type": "'desktop' | 'mobile' | 'tablet' | 'unknown'", "device_model": "string | 'unknown'", "screen_resolution": "string | 'unknown'", "network_type": "string | 'unknown'" } CONSTRAINTS: - Extract information only from the provided bug report text. - If a field is not explicitly mentioned, set its value to the literal string "unknown". - Do not infer or guess values based on common defaults. - Normalize common abbreviations (e.g., "Win 11" -> "Windows 11"). - Output ONLY the valid JSON object. No markdown fences, no commentary.
To adapt this template, replace the [INPUT] placeholder with the raw bug report text. For production use, you should wrap this prompt in a validation harness that checks the output against the JSON schema and flags any field where the model hallucinated a value instead of using unknown. For high-stakes triage, add a human review step when the application_version or os_version fields are unknown for a critical bug, as these details are often essential for reproduction.
Prompt Variables
Required and optional inputs for the Bug Report Environment Details Extraction Prompt. Each placeholder must be populated before the prompt is sent. Validation notes describe how to check input quality before execution.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[BUG_REPORT_TEXT] | The raw, unstructured bug report text from the user or support channel | App crashes when I click Save on Windows 11. Chrome version 120.0.6099.109. Happens every time. | Check that input is non-empty string with at least 20 characters. Reject reports that are only screenshots or attachments without text. |
[ENVIRONMENT_FIELDS] | Ordered list of environment fields to extract with expected types | ["os", "os_version", "browser", "browser_version", "app_version", "device_type", "network"] | Validate that the list is a JSON array of strings. Each field name must match the downstream schema exactly. Missing fields in the list will not be extracted. |
[OUTPUT_SCHEMA] | JSON Schema definition for the structured environment block output | {"type": "object", "properties": {"os": {"type": "string"}, "os_version": {"type": "string"}}, "required": ["os"]} | Schema must be valid JSON Schema draft-07 or later. Required fields must be a subset of defined properties. Test schema parsing before prompt execution. |
[UNKNOWN_MARKER] | Explicit string token to use when a field cannot be determined from the report | unknown | Marker must be a non-empty string distinct from any valid environment value. Do not use empty string or null. Validate that extracted output uses this marker consistently for missing fields. |
[CONFIDENCE_THRESHOLD] | Minimum confidence score (0.0-1.0) for accepting an extracted value. Values below threshold should use the unknown marker. | 0.7 | Must be a float between 0.0 and 1.0. Lower thresholds increase false extractions. Higher thresholds increase unknown markers. Calibrate against a labeled validation set. |
[CONTEXT_HINTS] | Optional known environment context to help disambiguate ambiguous mentions | {"supported_browsers": ["Chrome", "Firefox", "Safari", "Edge"], "app_versions": ["2.4.1", "2.4.2", "2.5.0"]} | Validate that context hints are a valid JSON object. Null is allowed when no context is available. Hints must not override explicit report content. |
[REQUIRED_FIELDS] | List of field names that must have a non-unknown value for the extraction to be considered complete | ["os", "app_version"] | Validate as JSON array of strings. Each entry must exist in [ENVIRONMENT_FIELDS]. If a required field resolves to the unknown marker, flag the extraction for human review. |
[MAX_TOKENS] | Token budget for the extraction response to prevent runaway output | 512 | Must be a positive integer. Set based on the number of fields and expected value lengths. Monitor actual token usage in production and adjust if truncation occurs. |
Implementation Harness Notes
How to wire the environment extraction prompt into a production triage pipeline with validation, retries, and routing.
This prompt is designed to be called as a stateless extraction step inside a larger bug report ingestion pipeline. The typical flow is: receive an unstructured bug report via API, webhook, or support ticket → extract the freeform description field → call this prompt with the description as [BUG_DESCRIPTION] → validate the structured output → merge the environment block into the canonical ticket object before routing. The prompt should be treated as a pure function: same input produces the same structured extraction, with no side effects or state mutation. This makes it safe to retry, cache, or run in parallel across multiple reports.
Validation and retry logic is critical because missing or malformed environment fields break downstream routing and debugging. After the model returns the JSON environment block, run a schema validator that checks: (1) all required keys are present (os, os_version, browser, browser_version, app_version, device_type, device_model, screen_resolution, network_type, locale, timezone, additional_context), (2) no key has a null value—use the string 'unknown' as the explicit missing marker, (3) device_type is one of the allowed enum values (desktop, mobile, tablet, unknown), and (4) version strings match a reasonable pattern (e.g., major.minor.patch or major.minor). If validation fails, retry once with the same prompt plus the validation error message appended as [PREVIOUS_ERROR]. If the retry also fails, log the raw output and the validation failure for manual review, then fall back to a default environment block with all fields set to 'unknown' and a flag extraction_status: 'failed' so downstream systems know the data is unreliable.
Model selection and latency matter here because triage pipelines often process hundreds of reports per hour. For high-throughput scenarios, use a fast, cost-efficient model like GPT-4o-mini, Claude Haiku, or Gemini Flash. These models handle structured extraction reliably at low latency. Reserve larger models (GPT-4o, Claude Sonnet) for cases where the retry also fails or where the bug description is unusually ambiguous. Implement a circuit breaker: if extraction latency exceeds 2 seconds for more than 5% of requests in a rolling window, degrade to a regex-based fallback extractor that pulls version numbers and OS names with simple pattern matching. This keeps the pipeline moving even if the model endpoint is slow or unavailable.
Logging and observability should capture the prompt version, model used, input length, output JSON, validation status, and latency for every extraction call. Attach these logs to the bug report ID so triage leads can trace any misclassification back to the extraction step. Set up an accuracy monitor that samples 5% of extractions and compares them against manually labeled environment blocks. If the field-level accuracy drops below 90% for any single field, trigger an alert for prompt review. Common drift signals include new browser version formats, OS naming changes (e.g., 'macOS 15 Sequoia' vs 'macOS 15.0'), or user reports that describe environments in novel ways the prompt hasn't seen.
Human review integration is required when the extraction confidence is low. Add a confidence field to the output schema (not part of the environment block itself, but returned alongside it) that the model sets to high, medium, or low based on how many fields it had to mark as 'unknown' and how ambiguous the source text was. If confidence is low, route the ticket to a manual triage queue where a human can fill in the environment details before the bug reaches an engineering team. This prevents bad environment data from wasting developer time on unreproducible bugs. For regulated or high-severity bug workflows (e.g., security vulnerabilities, data loss), always require human confirmation of the extracted environment regardless of confidence score.
What to avoid: Do not call this prompt inside a user-facing chat interface where the reporter is waiting for a response. The extraction should happen asynchronously after the report is submitted. Do not use the extracted environment block to auto-close or auto-reject bugs—missing environment details are a signal to ask the reporter for more information, not to discard the report. Finally, do not skip validation even if the model output looks correct; schema drift is the most common failure mode in production extraction pipelines, and a single malformed field can break downstream JSON parsers or routing logic.
Expected Output Contract
Fields, format, and validation rules for the structured environment block extracted from an unstructured bug report. Use this contract to build a post-processing validator that rejects incomplete or malformed outputs before they reach the routing engine.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
environment_block | JSON object | Top-level key must be present. Must contain at least one non-null field. Reject if missing or empty object. | |
os | string | null | Normalize to canonical name (e.g., 'Windows 11', 'macOS Sonoma'). If detected but ambiguous, set to null and populate [CONFIDENCE_NOTES]. Do not guess. | |
os_version | string | null | Must match a version-like pattern (e.g., '23H2', '14.5'). If only a major version is detected, record it. Set to null if no version token found. | |
browser | string | null | Normalize to canonical name (e.g., 'Chrome', 'Safari', 'Firefox'). Map common nicknames. Set to null if no browser string detected. | |
browser_version | string | null | Must match a version-like pattern. Do not infer from browser name alone. Set to null if no version token found. | |
app_version | string | null | Extract the application version string exactly as reported. Do not reformat. Set to null if no version-like token found in the report text. | |
device_type | enum string | null | Must be one of: 'desktop', 'mobile', 'tablet', 'unknown'. Infer from OS, screen size mentions, or device model keywords. Default to 'unknown' if no signal. | |
device_model | string | null | Extract specific model if mentioned (e.g., 'iPhone 15 Pro', 'ThinkPad X1'). Set to null if not reported. Do not infer model from OS alone. | |
network_context | string | null | Capture if explicitly mentioned (e.g., 'corporate VPN', 'home Wi-Fi', '5G'). Set to null if not reported. Do not assume. | |
raw_environment_text | string | The exact substring from the bug report used to populate the environment fields. Required for auditability. Reject if missing or empty. | |
confidence_notes | string[] | Array of strings flagging any field with low extraction confidence. Each note must reference the specific field and the reason for uncertainty. Empty array allowed. |
Common Failure Modes
What breaks first when extracting environment details from unstructured bug reports, and how to guard against it.
Missing Fields Become Hallucinations
What to watch: When a bug report omits OS, browser, or version details, the model often invents plausible values instead of returning 'unknown'. This silently corrupts your triage data with fake environment information. Guardrail: Explicitly require 'unknown' markers in the output schema and add a post-extraction validator that flags any field containing a real value when the source text lacks that information.
Version String Normalization Drift
What to watch: Users report versions as 'latest', 'current', 'newest', or with inconsistent formatting (v14, 14.0, 14.0.1). The model normalizes these differently across reports, breaking version-based filtering and regression detection. Guardrail: Provide a version normalization map in the prompt context and validate extracted versions against a known release list. Flag ambiguous qualifiers like 'latest' for human clarification.
Multi-Device Confusion
What to watch: Reports mentioning multiple devices, browsers, or environments (e.g., 'works on Chrome but broken on Safari') cause the model to mix fields or extract only the first environment mentioned. Guardrail: Structure the output to support multiple environment blocks when the report describes more than one setup. Add a validation check that detects when a single output block contains values from different devices.
Log and Error Message Misattribution
What to watch: Stack traces or error logs pasted into bug reports contain their own environment markers (e.g., User-Agent strings, server versions). The model extracts from the log instead of the user's actual environment, producing wrong details. Guardrail: Instruct the prompt to prioritize user-stated environment details over log-derived metadata. Add a conflict detection step that flags when log metadata contradicts user-reported environment fields.
Non-Standard Platform Identification
What to watch: Embedded devices, gaming consoles, smart TVs, and IoT platforms are reported with colloquial names or model numbers the model doesn't recognize. It either maps them to the wrong platform or drops them entirely. Guardrail: Maintain a platform alias map in the prompt context covering common non-standard devices. When no match is found, preserve the raw user string in a 'raw_platform' field and mark 'platform' as 'unknown' rather than guessing.
Locale and Timezone Extraction Gaps
What to watch: Locale settings, timezone offsets, and language preferences are rarely stated explicitly but critically affect bug reproduction. The model either ignores these signals or infers them from unrelated context like the user's writing language. Guardrail: Add dedicated locale and timezone fields to the output schema with 'unknown' defaults. When the report contains timestamps, extract the offset. Validate that inferred locales are not based solely on the report's language.
Evaluation Rubric
Criteria for evaluating the quality of extracted environment details before integrating the prompt into a production triage pipeline. Each criterion should be tested against a golden dataset of manually labeled bug reports.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Field Extraction Accuracy | Extracted value matches the manually labeled value for OS, Browser, App Version, and Device in >= 95% of test cases. | Extracted value differs from the golden label. Common failures include parsing 'iOS 17.1' as '17' or missing the browser version entirely. | Automated string comparison against a golden dataset of 100 manually labeled reports. |
Unknown Marker Compliance | Fields not present in the source text are explicitly marked as 'unknown' with 100% recall. | A missing field is hallucinated (e.g., 'Windows' when no OS is mentioned) or left as a null/empty string instead of the required 'unknown' token. | Schema validation check that all required fields are non-null and that the 'unknown' token is used correctly based on source text absence. |
Output Schema Validity | Output is valid JSON that strictly conforms to the defined [OUTPUT_SCHEMA] with all required fields present. | JSON parsing fails, a required field is missing, or an extra unconstrained field is present in the output object. | Automated JSON Schema validation check run on every output. |
Enum and Format Adherence | Values for OS and Browser match the allowed enum lists or canonical formats specified in [CONSTRAINTS]. | A non-standard value is used (e.g., 'MacOS' instead of 'macOS', 'Chrome 123' instead of '123.0.0.0'). | Post-extraction normalization check comparing extracted values against a predefined canonical list. |
Noise Rejection | The prompt correctly ignores environment details mentioned in stack traces, logs, or user-agent strings that are not the reporter's actual environment. | A server-side OS from a stack trace is extracted as the user's OS, or a user-agent string from a pasted log is mistaken for the current browser. | Targeted test cases containing misleading log snippets and user-agent strings within the [BUG_REPORT] body. |
Version Number Precision | Full version numbers are extracted without truncation or rounding (e.g., '17.1.2', not '17.1'). | A version string is truncated, rounded, or partially captured, losing patch or build number information. | Regex pattern check on the extracted version field to verify it matches the full version string from the golden label. |
Device Model Specificity | Device field captures the specific model identifier when available (e.g., 'iPhone 15 Pro') rather than a generic category (e.g., 'iPhone'). | The model is overly generalized, or a marketing name is confused with an internal model identifier. | String similarity check (e.g., fuzzy matching) against a list of known device models in the golden dataset. |
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
Start with the base extraction prompt and a simple JSON schema. Use a single model call without retries or validation beyond basic JSON parse. Accept unknown markers for any missing field. Run against 20-30 manually labeled reports to spot extraction gaps.
codeExtract environment details from the bug report below. Return JSON with these fields: - os: [string or "unknown"] - browser: [string or "unknown"] - app_version: [string or "unknown"] - device: [string or "unknown"] Bug report: [REPORT_TEXT]
Watch for
- Model hallucinating plausible values when the report is silent (e.g., guessing "Windows 10" from no signal)
- Inconsistent field naming across runs
- Multi-line log pastes being treated as environment descriptions

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