{"record":{"id":"84a7240897dbccd3","repo":"temporalio/temporal","slug":"missing-or-invalid-query","errorCode":null,"errorMessage":"missing or invalid query","messagePattern":"missing or invalid query","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/worker/scheduler/workflow.go","lineNumber":1167,"sourceCode":"\treturn out\n}\n\nfunc (s *scheduler) handleDescribeQuery() (*schedulespb.DescribeResponse, error) {\n\t// this is a query handler, don't modify s.Info directly\n\tinfoCopy := common.CloneProto(s.Info)\n\tinfoCopy.FutureActionTimes = s.getFutureActionTimes(false, s.tweakables.FutureActionCount)\n\tinfoCopy.BufferSize = int64(len(s.State.BufferedStarts))\n\n\treturn &schedulespb.DescribeResponse{\n\t\tSchedule:      s.Schedule,\n\t\tInfo:          infoCopy,\n\t\tConflictToken: s.State.ConflictToken,\n\t}, nil\n}\n\nfunc (s *scheduler) handleListMatchingTimesQuery(req *workflowservice.ListScheduleMatchingTimesRequest) (*workflowservice.ListScheduleMatchingTimesResponse, error) {\n\tif req == nil || req.StartTime == nil || req.EndTime == nil {\n\t\treturn nil, errors.New(\"missing or invalid query\")\n\t}\n\tif s.cspec == nil {\n\t\treturn nil, fmt.Errorf(\"invalid schedule: %s\", s.Info.InvalidScheduleError)\n\t}\n\n\tvar out []*timestamppb.Timestamp\n\tt1 := timestamp.TimeValue(req.StartTime)\n\tfor range maxListMatchingTimesCount {\n\t\t// don't need to call GetNextTime in SideEffect because this is just a query\n\t\tres, err := s.cspec.GetNextTime(s.jitterSeed(), t1)\n\t\tif err != nil {\n\t\t\t// An over-excluded spec won't resolve until it's edited, so return a\n\t\t\t// non-retryable code: retrying would just re-burn the compute bound each call.\n\t\t\treturn nil, ErrScheduleSpecLimitHit\n\t\t}\n\t\tt1 = res.Next\n\t\tif t1.IsZero() || t1.After(timestamp.TimeValue(req.EndTime)) {\n\t\t\tbreak","sourceCodeStart":1149,"sourceCodeEnd":1185,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/service/worker/scheduler/workflow.go#L1149-L1185","documentation":"handleListMatchingTimesQuery handles the ListScheduleMatchingTimes workflow query. It requires a non-nil request carrying both StartTime and EndTime; if the query input is missing or lacks the time range, it returns this error. A nil s.cspec additionally indicates the schedule itself is invalid and yields a different error.","triggerScenarios":"Issuing a ListScheduleMatchingExecutions / ListScheduleMatchingTimes query against a schedule workflow with a nil request, or with StartTime or EndTime unset (nil protobuf timestamps).","commonSituations":"CLI/SDK calls where start/end flags were not provided; programmatic query invocation constructing the request struct but forgetting timestamppb fields; tooling sending an empty query payload to the workflow.","solutions":["Provide both StartTime and EndTime in the ListScheduleMatchingTimesRequest, e.g. timestamppb.New(time.Now()) and timestamppb.New(time.Now().Add(7*24*time.Hour)).","Use the SDK's Schedule.ListTimes helper instead of hand-building the query payload so required fields are populated.","Check the CLI command arguments — ensure the time range flags are actually passed.","If this appears despite valid input, verify the schedule is not invalid (a nil cspec produces 'invalid schedule: ...' instead)."],"exampleFix":"// before\nresp, err := scheduleHandle.query(ctx, \"list-schedule-matching-times\", nil)\n// after\nreq := &workflowservice.ListScheduleMatchingTimesRequest{\n    StartTime: timestamppb.New(start),\n    EndTime:   timestamppb.New(end),\n}\nresp, err := scheduleHandle.ListMatchingTimes(ctx, req)","handlingStrategy":"validation","validationCode":"func validMatchingTimesReq(req *workflowservice.ListScheduleMatchingTimesRequest) bool {\n    return req != nil && req.StartTime != nil && req.EndTime != nil\n}","typeGuard":"func hasTimeRange(req *workflowservice.ListScheduleMatchingTimesRequest) bool {\n    return req != nil && req.GetStartTime() != nil && req.GetEndTime() != nil\n}","tryCatchPattern":null,"preventionTips":["Always pass both start and end times when querying matching times","Use SDK Schedule helpers instead of hand-built query payloads","Add required-flag checks to CLI commands that issue this query","Return a clear client-side error when the time range is absent"],"tags":["go","scheduler","query","validation"],"backgroundTag":"missing-query-parameter","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}