{"record":{"id":"f02fead5757debb9","repo":"danielmiessler/Fabric","slug":"no-output-received-from-create-pattern","errorCode":null,"errorMessage":"No output received from create_pattern","messagePattern":"No output received from create_pattern","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"scripts/python_ui/streamlit.py","lineNumber":424,"sourceCode":"                if not current_provider or not current_model:\n                    raise ValueError(\"Please select a provider and model first.\")\n\n                # Execute fabric create_pattern with input content\n                cmd = [\"fabric\", \"--pattern\", \"create_pattern\"]\n                if current_provider and current_model:\n                    cmd.extend([\"--vendor\", current_provider, \"--model\", current_model])\n\n                logger.debug(f\"Running command: {' '.join(cmd)}\")\n                logger.debug(f\"Input content:\\n{content}\")\n\n                # Execute pattern\n                result = run(\n                    cmd, input=content, capture_output=True, text=True, check=True\n                )\n                structured_content = result.stdout.strip()\n\n                if not structured_content:\n                    raise ValueError(\"No output received from create_pattern\")\n\n                # Save the structured content to system.md\n                system_file = os.path.join(new_pattern_path, \"system.md\")\n                with open(system_file, \"w\") as f:\n                    f.write(structured_content)\n\n                # Validate the created pattern\n                is_valid, validation_message = validate_pattern(pattern_name)\n                if not is_valid:\n                    raise ValueError(f\"Pattern validation failed: {validation_message}\")\n\n                logger.info(\n                    f\"Successfully created pattern '{pattern_name}' with structured content\"\n                )\n\n            except CalledProcessError as e:\n                error_msg = f\"Error running create_pattern: {e.stderr}\"\n                logger.error(error_msg)","sourceCodeStart":406,"sourceCodeEnd":442,"githubUrl":"https://github.com/danielmiessler/Fabric/blob/338b89cfe97ab2d12ce30ce8b5449857a841366d/scripts/python_ui/streamlit.py#L406-L442","documentation":"Raised after `run([\"fabric\", \"--pattern\", \"create_pattern\", ...])` succeeds (exit 0) but stdout is empty after stripping. The Fabric CLI exited cleanly yet printed nothing to stdout — meaning the LLM returned an empty completion or the model's output went to stderr. The script treats an empty pattern body as invalid because it is about to be written to system.md.","triggerScenarios":"The configured model returning an empty response (over-aggressive content filter, context length exceeded with empty fallback, temperature/parameter edge case); fabric writing errors to stderr while exiting 0; a pattern input so short the model responds with whitespace; a vendor quota issue that fabric swallows.","commonSituations":"Free-tier models returning empty completions, safety filters silently blocking the prompt content, fabric CLI version differences in output routing, very large pasted content getting truncated to nothing.","solutions":["Retry the creation once — empty LLM completions are often transient","Inspect result.stderr in the error path; fabric frequently logs the real reason there even on exit 0","Run the same command manually with the same input: `echo '<content>' | fabric --pattern create_pattern --vendor X --model Y` and look at both streams","Switch to a different model/vendor known to comply, or reduce/simplify the input content"],"exampleFix":"# before\nresult = run(cmd, input=content, capture_output=True, text=True, check=True)\nstructured_content = result.stdout.strip()\nif not structured_content:\n    raise ValueError(\"No output received from create_pattern\")\n\n# after\nresult = run(cmd, input=content, capture_output=True, text=True, check=True)\nstructured_content = result.stdout.strip()\nif not structured_content:\n    stderr = result.stderr.strip()\n    raise ValueError(\n        \"No output received from create_pattern\"\n        + (f\" (fabric stderr: {stderr[:300]})\" if stderr else \" — model returned an empty completion, retry or switch model\")\n    )","handlingStrategy":"retry","validationCode":"# Cheap precondition: refuse empty prompts before spawning fabric\nif not content or not content.strip():\n    return False, \"Pattern content is empty; provide content to structure.\"\ncfg = st.session_state.get(\"config\", {})\nif not (cfg.get(\"vendor\") and cfg.get(\"model\")):\n    return False, \"Select a provider and model first.\"","typeGuard":null,"tryCatchPattern":"last_err = None\nfor attempt in range(2):\n    result = run(cmd, input=content, capture_output=True, text=True, check=True)\n    structured_content = result.stdout.strip()\n    if structured_content:\n        break\n    last_err = result.stderr.strip() or \"model returned an empty completion\"\nif not structured_content:\n    if os.path.exists(new_pattern_path):\n        shutil.rmtree(new_pattern_path)\n    return False, f\"No output received from create_pattern ({last_err[:300]})\"","preventionTips":["Retry empty completions once — they are frequently transient","Capture and surface result.stderr even on exit 0; fabric logs the real reason there","Test the exact command manually (echo ... | fabric --pattern create_pattern ...) when output is unexpectedly empty","Prefer models with reliable instruction-following for generate/structure tasks"],"tags":["fabric","subprocess","llm","empty-output"],"backgroundTag":null,"analyzedSha":"338b89cfe97ab2d12ce30ce8b5449857a841366d","analyzedAt":"2026-08-15T11:38:51.759Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}