CadQuery CQGI NoOutputError

Diagnostic signature

NoOutputError

The NoOutputError occurs in a CadQuery script executing inside a CQGI container (like CQ-Editor or cq-cli) when the script generates geometry but fails to export it to the environment by calling the injected show_object() method.

What it means

When executing CadQuery code inside of a CadQuery Gateway Interface (CQGI) compliant environment—such as CQ-Editor, jupyter-cadquery, or the cq-cli runner—the environment requires the script to explicitly publish the resulting 3D geometry. The NoOutputError indicates that the environment parsed and executed the Python script entirely, but the script exited without ever calling the built-in show_object() method to register an output shape.

Why it happens

To allow host applications to inspect, display, or export CadQuery parametric solids, CQGI injects a show_object() callback into the local execution environment of the script. When the script is evaluated, CQGI records any geometry passed to this callback. After the script terminates, the container checks the callback's state. If the output registry is empty, the CQGI orchestrator raises cadquery.cqgi.NoOutputError to inform the caller that the script produced no visualizable or exportable outcome. This occurs when a user forgets to add show_object() at the end of their file or bypasses it via conditional logic.

Minimal reproduction

import cadquery.cqgi as cqgi

# A script designed for CQ-Editor, run here via CQGI
cadquery_script = """
import cadquery as cq

# Creating a geometric body, but failing to export it
model = cq.Workplane("XY").box(10, 10, 10)
"""

# Parsing and executing the script in a CQGI environment
result = cqgi.parse(cadquery_script).build()

if not result.success:
    # This will explicitly raise cadquery.cqgi.NoOutputError
    raise result.exception

How to fix it

Call the show_object() method exposed by the CQGI environment, passing the final CadQuery shape to ensure the container receives the geometry.

```python
import cadquery.cqgi as cqgi

cadquery_script = """
import cadquery as cq

model = cq.Workplane("XY").box(10, 10, 10)

# Export the solid to the CQGI environment
show_object(model)
"""

result = cqgi.parse(cadquery_script).build()

if not result.success:
    raise result.exception
else:
    print(f"Successfully generated {len(result.results)} output objects.")

```

Step 1

Step 2

Upstream references

The CadQuery Gateway Interface - cadquery.cqgi.NoOutputError

Source code for cadquery.cqgi - NoOutputError