danielmiessler/Fabric · error · ValueError

No output received from create_pattern

Error message

No output received from create_pattern

What it means

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.

Source

Thrown at scripts/python_ui/streamlit.py:424

                if not current_provider or not current_model:
                    raise ValueError("Please select a provider and model first.")

                # Execute fabric create_pattern with input content
                cmd = ["fabric", "--pattern", "create_pattern"]
                if current_provider and current_model:
                    cmd.extend(["--vendor", current_provider, "--model", current_model])

                logger.debug(f"Running command: {' '.join(cmd)}")
                logger.debug(f"Input content:\n{content}")

                # Execute pattern
                result = run(
                    cmd, input=content, capture_output=True, text=True, check=True
                )
                structured_content = result.stdout.strip()

                if not structured_content:
                    raise ValueError("No output received from create_pattern")

                # Save the structured content to system.md
                system_file = os.path.join(new_pattern_path, "system.md")
                with open(system_file, "w") as f:
                    f.write(structured_content)

                # Validate the created pattern
                is_valid, validation_message = validate_pattern(pattern_name)
                if not is_valid:
                    raise ValueError(f"Pattern validation failed: {validation_message}")

                logger.info(
                    f"Successfully created pattern '{pattern_name}' with structured content"
                )

            except CalledProcessError as e:
                error_msg = f"Error running create_pattern: {e.stderr}"
                logger.error(error_msg)

View on GitHub (pinned to 338b89cfe9)

Solutions

  1. Retry the creation once — empty LLM completions are often transient
  2. Inspect result.stderr in the error path; fabric frequently logs the real reason there even on exit 0
  3. Run the same command manually with the same input: `echo '<content>' | fabric --pattern create_pattern --vendor X --model Y` and look at both streams
  4. Switch to a different model/vendor known to comply, or reduce/simplify the input content

Example fix

# before
result = run(cmd, input=content, capture_output=True, text=True, check=True)
structured_content = result.stdout.strip()
if not structured_content:
    raise ValueError("No output received from create_pattern")

# after
result = run(cmd, input=content, capture_output=True, text=True, check=True)
structured_content = result.stdout.strip()
if not structured_content:
    stderr = result.stderr.strip()
    raise ValueError(
        "No output received from create_pattern"
        + (f" (fabric stderr: {stderr[:300]})" if stderr else " — model returned an empty completion, retry or switch model")
    )
Defensive patterns

Strategy: retry

Validate before calling

# Cheap precondition: refuse empty prompts before spawning fabric
if not content or not content.strip():
    return False, "Pattern content is empty; provide content to structure."
cfg = st.session_state.get("config", {})
if not (cfg.get("vendor") and cfg.get("model")):
    return False, "Select a provider and model first."

Try / catch

last_err = None
for attempt in range(2):
    result = run(cmd, input=content, capture_output=True, text=True, check=True)
    structured_content = result.stdout.strip()
    if structured_content:
        break
    last_err = result.stderr.strip() or "model returned an empty completion"
if not structured_content:
    if os.path.exists(new_pattern_path):
        shutil.rmtree(new_pattern_path)
    return False, f"No output received from create_pattern ({last_err[:300]})"

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of danielmiessler/Fabric@338b89cfe9 (2026-08-15). Data as JSON: /api/errors/f02fead5757debb9. Report an issue: GitHub.