StringData index out of range failure due to empty paths PBT testing

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Optimization
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      [j0] {"t":{"$date":"2026-03-04T14:15:34.739+00:00"},"s":"F",  "c":"ASSERT",   "id":23081,   "ctx":"conn12","msg":"Invariant failure","attr":{"expr":"pos < size()","msg":"StringData index out of range","location":"src/mongo/base/string_data.h:171:68:const_reference mongo::StringData::operator[](size_t) const"}}
      [j0] {"t":{"$date":"2026-03-04T14:15:34.740+00:00"},"s":"F",  "c":"ASSERT",   "id":23082,   "ctx":"conn12","msg":"\n\n***aborting after invariant() failure\n\n"}
      [j0] {"t":{"$date":"2026-03-04T14:15:34.740+00:00"},"s":"F",  "c":"CONTROL",  "id":6384300, "ctx":"conn12","msg":"Writing fatal message","attr":{"message":"Got signal: 6 (Aborted).\n"}}
      [j0] BACKTRACE: 
      
      [j0] #6 0x0000eac3ace878f7 at linux-vdso.so.1
      [j0] #7 0x0000eac3ac57f1ef in __pthread_kill_implementation
      [j0]                    at nptl/pthread_kill.c:43:17
      [j0] #8 0x0000eac3ac53a67b in __GI_raise
      [j0]                    at signal/../sysdeps/posix/raise.c:26:13
      [j0] #9 0x0000eac3ac52712f in __GI_abort
      [j0]                    at stdlib/abort.c:79:7
      [j0] #10 0x0000c052d9f2645f in mongo::(anonymous namespace)::callAbort()
      [j0]                    at src/mongo/util/assert_util.cpp:95:46
      [j0]       93:         endProcessWithSignal(SIGABRT);
      [j0]       94:
      [j0]     > 95:     [[maybe_unused]] static auto initOnce = (std::abort(), 0);
      [j0]                                                        ^
      [j0]       96:     MONGO_COMPILER_UNREACHABLE;
      [j0]       97: }
      [j0] #11 0x0000c052d9f25e6f in void mongo::(anonymous namespace)::invariantFailedImpl<mongo::WrappedStdSourceLocation>(char const*, std::string const&, mongo::WrappedStdSourceLocation)
      [j0]                    at src/mongo/util/assert_util.cpp:142:5
      [j0]      140:     breakpoint();
      [j0]      141:     LOGV2_FATAL_CONTINUE(23082, "\n\n***aborting after invariant() failure\n\n");
      [j0]    > 142:     callAbort();
      [j0]               ^
      [j0]      143: }
      [j0]      144: }  // namespace
      [j0] #12 0x0000c052d9f25ccb in mongo::error_details::invariantFailedWithMsg(char const*, std::string const&, mongo::WrappedStdSourceLocation)
      [j0]                    at src/mongo/util/assert_util.cpp:156:5
      [j0]      154:                                                     const std::string& msg,
      [j0]      155:                                                     WrappedStdSourceLocation loc) noexcept {
      [j0]    > 156:     invariantFailedImpl(expr, msg, loc);
      [j0]               ^
      [j0]      157: }
      [j0]      158: #endif  // MONGO_SOURCE_LOCATION_HAVE_STD
      [j0] #13 0x0000c052cca48467 in void mongo::error_details::invariantWithContextAndLocation<bool, mongo::StringData::operator[](unsigned long) const::{lambda()#1}>(bool const&, char const*, mongo::StringData::operator[](unsigned long) const::{lambda()#1}&&, mongo::WrappedStdSourceLocation)
      [j0]                    at src/mongo/util/assert_util_core.h:95:9
      [j0]       93:     SourceLocation loc = MONGO_SOURCE_LOCATION()) {
      [j0]       94:     if (MONGO_unlikely(!testOK)) {
      [j0]     > 95:         ::mongo::error_details::invariantFailedWithMsg(expr, contextExpr(), loc);
      [j0]                   ^
      [j0]       96:     }
      [j0]       97: }
      [j0] #14 0x0000c052cca483b7 in mongo::StringData::operator[](unsigned long) const
      [j0]                    at src/mongo/base/string_data.h:171:13
      [j0]      169:     constexpr const_reference operator[](size_t pos) const {
      [j0]      170:         if (kDebugBuild && !(pos < size()))
      [j0]    > 171:             invariant(pos < size(), "StringData index out of range");
      [j0]                       ^
      [j0]      172:         return _sv[pos];
      [j0]      173:     }
      [j0] #15 0x0000c052d48dc09b in mongo::AccumulationStatement::parseAccumulationStatement(mongo::ExpressionContext*, mongo::BSONElement const&, mongo::VariablesParseState const&)
      [j0]                    at src/mongo/db/pipeline/accumulation_statement.cpp:90:5
      [j0]       88:             fieldName.find('.') == string::npos);
      [j0]       89:
      [j0]     > 90:     uassert(40236,
      [j0]               ^
      [j0]       91:             str::stream() << "The field name '" << fieldName << "' cannot be an operator name",
      [j0]       92:             fieldName[0] != '$');
      [j0] #16 0x0000c052d45141d3 in mongo::DocumentSourceGroupBase::initializeFromBson(mongo::BSONElement)
      [j0]                    at src/mongo/db/pipeline/document_source_group_base.cpp:319:17
      [j0]      317:             // Any other field will be treated as an accumulator specification.
      [j0]      318:             _groupProcessor->addAccumulationStatement(
      [j0]    > 319:                 AccumulationStatement::parseAccumulationStatement(
      [j0]                           ^
      [j0]      320:                     getExpCtx().get(), groupField, vps));
      [j0]      321:         }
      [j0] #17 0x0000c052d44fd24b in mongo::DocumentSourceGroup::createFromBsonWithMaxMemoryUsage(mongo::BSONElement, boost::intrusive_ptr<mongo::ExpressionContext> const&, boost::optional<long>)
      [j0]                    at src/mongo/db/pipeline/document_source_group.cpp:700:17
      [j0]      698:     boost::intrusive_ptr<DocumentSourceGroup> groupStage(
      [j0]      699:         new DocumentSourceGroup(expCtx, maxMemoryUsageBytes));
      [j0]    > 700:     groupStage->initializeFromBson(elem);
      [j0]                           ^
      [j0]      701:     return groupStage;
      [j0]      702: }
      [j0] #18 0x0000c052d44fcc77 in mongo::DocumentSourceGroup::createFromBson(mongo::BSONElement, boost::intrusive_ptr<mongo::ExpressionContext> const&)
      [j0]                    at src/mongo/db/pipeline/document_source_group.cpp:93:12
      [j0]       91: boost::intrusive_ptr<DocumentSource> DocumentSourceGroup::createFromBson(
      [j0]       92:     BSONElement elem, const boost::intrusive_ptr<ExpressionContext>& expCtx) {
      [j0]     > 93:     return createFromBsonWithMaxMemoryUsage(std::move(elem), expCtx, boost::none);
      [j0]                      ^
      [j0]       94: }
      [j0] #19 0x0000c052d44fcabb in mongo::groupStageParamsToDocumentSourceFn[abi:cxx11](std::unique_ptr<mongo::StageParams> const&, boost::intrusive_ptr<mongo::ExpressionContext> const&)
      [j0]                    at src/mongo/db/pipeline/document_source_group.cpp:62:1
      [j0]       60: REGISTER_LITE_PARSED_DOCUMENT_SOURCE(group, GroupLiteParsed::parse, AllowedWithApiStrict::kAlways);
      [j0]       61:
      [j0]     > 62: REGISTER_DOCUMENT_SOURCE_WITH_STAGE_PARAMS_DEFAULT(group, DocumentSourceGroup, GroupStageParams);
      [j0]           ^
      [j0]       63:

      full log attached

        1. pbt_all.log
          718 kB
          Hagar Mohamed

            Assignee:
            Unassigned
            Reporter:
            Hagar Mohamed
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: