I think when you use optixGetPrimitiveIndex() in a hit shader, then this function may not need to use the traversable handle or sbtGasIndex in order to look up your triangle data. If you use a different primitive index than the current hit, then it likely will need those extra arguments. Even in cases when these arguments might not be needed, note that there can still be exceptions and validation errors if you pass bogus info, and behavior might change in the future to require the arguments to match a valid GAS & SBT. For that reason, we recommend using optixGetGASTraversableHandle(), optixGetPrimitiveIndex(), and optixGetSbtGASIndex() even for the current hit primitive.
There is a paragraph hinting at this, along with more info about vertex random access, in the OptiX Programming Guide: " Care has to be taken if optixGetTriangleVertexData is used with a primitive index other than the value returned by optixGetPrimitiveIndex. optixGetTriangleVertexData expects a local primitive index corresponding to the build input / sbtGASIndex plus the primitive index offset as specified in the build input at the acceleration structure build."
And note that if you want random access (meaning accessing data for other triangles besides the current hit) you will need to build your AS using OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS