temporalio/temporal · error

unable to parse 'doc_count' field: %w

Error message

unable to parse 'doc_count' field: %w

What it means

Error "unable to parse 'doc_count' field: %w" thrown in temporalio/temporal.

Source

Thrown at common/persistence/visibility/store/elasticsearch/visibility_store.go:1215

			return nil, err
		}
		groupByTypes[i] = tp
	}

	parseJsonNumber := func(val any) (int64, error) {
		numberVal, isNumber := val.(json.Number)
		if !isNumber {
			return 0, fmt.Errorf("%w: expected json.Number, got %T", errUnexpectedJSONFieldType, val)
		}
		return numberVal.Int64()
	}

	var parseInternal func(map[string]any, []*commonpb.Payload) error
	parseInternal = func(aggs map[string]any, bucketValues []*commonpb.Payload) error {
		if len(bucketValues) == len(groupByFields) {
			cnt, err := parseJsonNumber(aggs["doc_count"])
			if err != nil {
				return fmt.Errorf("unable to parse 'doc_count' field: %w", err)
			}
			groupValues := make([]*commonpb.Payload, len(groupByFields))
			copy(groupValues, bucketValues)
			response.Groups = append(
				response.Groups,
				store.InternalAggregationGroup{
					GroupValues: groupValues,
					Count:       cnt,
				},
			)
			response.Count += cnt
			return nil
		}

		index := len(bucketValues)
		fieldName := groupByFields[index]
		buckets := aggs[fieldName].(map[string]any)["buckets"].([]any)
		for i := range buckets {

View on GitHub (pinned to bde624efd1)

When it happens

Trigger: Thrown at common/persistence/visibility/store/elasticsearch/visibility_store.go:1215 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of temporalio/temporal@bde624efd1 (2026-09-01). Data as JSON: /api/errors/ae7cc19584837704. Report an issue: GitHub.