Can I not enter the miss shader?

I’m assuming you’re implementing some algorithm which gathers all intersections along a ray.
In that case, please also read the forum posts from this search result:
https://forums.developer.nvidia.com/search?q=all%20intersections%20along%20a%20ray%20%23visualization%3Aoptix

If you’re using a custom intersection program for that, you will not be able to benefit from built-in geometric primitives in OptiX 7 that way, which is especially important for performance when using triangles.

Mind that the intersection program is the most often called program in the ray tracing pipeline and is called in BVH traversal order not in ray direction order.

That said, if you never call optixReportIntersection (which would invoke the anyhit and potentially closesthit programs when the anyhit doesn’t call optixIgnoreIntersection) all rays will effectively miss all geometry.
There is no way around that in that case.

Never use an empty miss program! If you don’t need a miss program for a ray type, the fastest miss program is the NULL program.

Meaning if you build your OptixProgramGroupDesc structures for your pipeline, add an entry for kind = OPTIX_PROGRAM_GROUP_KIND_MISS which has nullptr for the miss.module and miss.entryFunctionName fields like this:

  pgd = &programGroupDescriptions[PROGRAM_ID_MISS_SHADOW];
  pgd->kind  = OPTIX_PROGRAM_GROUP_KIND_MISS;
  pgd->flags = OPTIX_PROGRAM_GROUP_FLAGS_NONE;
  pgd->miss.module            = nullptr; // Redundant after the memset() above, for code clarity.
  pgd->miss.entryFunctionName = nullptr; // No miss program for shadow rays.

Demonstrated in this example: https://github.com/NVIDIA/OptiX_Apps/blob/master/apps/intro_runtime/src/Application.cpp#L1833