Standard_NoSuchObject

Diagnostic signature

Standard_NoSuchObject

An exception raised by Open CASCADE Technology (OCCT) when an operation attempts to access a requested geometric or topological object that does not exist, or queries a property undefined for the current state.

What it means

In Open CASCADE Technology (verified in OCCT 7.8.0), `Standard_NoSuchObject` is an exception class derived from `Standard_DomainError`. It indicates that a requested entity, element, or property is fundamentally absent or inapplicable for the given object. This diagnostic typically surfaces during runtime execution when a developer queries an object for geometric or topological components it lacks—such as requesting the period of a non-periodic curve, retrieving the first datum from an empty location, or asking a transformation API for the modified version of a shape it never processed.

Why it happens

This diagnostic is emitted because the OCCT kernel enforces strict domain validity for queries to prevent silent logic errors or null pointer dereferences. Common triggers include: 1. Requesting the `Period()` from a `Geom_Curve` where `IsPeriodic()` returns false (such as a `Geom_Line`). 2. Calling `FirstDatum()` or `FirstPower()` on a default-constructed, empty `TopLoc_Location`. 3. Asking a shape modification algorithm (like `BRepBuilderAPI_ModifyShape` or `BRepOffsetAPI_NormalProjection`) for the generated or modified result of a sub-shape that was not part of the initial input. 4. Accessing elements from a topological explorer or `NCollection` iterator after it has been exhausted.

Minimal reproduction

#include <Geom_Line.hxx>
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
#include <iostream>

int main() {
    gp_Pnt origin(0.0, 0.0, 0.0);
    gp_Dir dir(1.0, 0.0, 0.0);
    Handle(Geom_Line) myLine = new Geom_Line(origin, dir);
    
    // Throws Standard_NoSuchObject because a line is not periodic
    double period = myLine->Period();
    
    std::cout << "Period: " << period << std::endl;
    return 0;
}

How to fix it

Guard access to properties or topological entities by validating the object's state using its corresponding boolean check (e.g., `IsPeriodic()`) before making the query.

```C++
#include <Geom_Line.hxx>
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
#include <iostream>

int main() {
    gp_Pnt origin(0.0, 0.0, 0.0);
    gp_Dir dir(1.0, 0.0, 0.0);
    Handle(Geom_Line) myLine = new Geom_Line(origin, dir);
    
    // Guard the query by checking if the curve is periodic
    if (myLine->IsPeriodic()) {
        double period = myLine->Period();
        std::cout << "Period: " << period << std::endl;
    } else {
        std::cout << "Curve is not periodic; period is undefined." << std::endl;
    }
    
    return 0;
}

```

Step 1

Step 2

Step 3

Upstream references

Open CASCADE Technology OCCT 7.8.0 — Standard_NoSuchObject.hxx — retrieved 2026-08-11

Geom_Curve Class Reference - Open CASCADE Technology

TopLoc_Location Class Reference - Open CASCADE Technology