temporalio/temporal · error

unable to encode value %v: %w

Error message

unable to encode value %v: %w

What it means

Error "unable to encode value %v: %w" thrown in temporalio/temporal.

Source

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

					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 {
			bucket := buckets[i].(map[string]any)
			value, err := finishParseJSONValue(bucket["key"], groupByTypes[index])
			if err != nil {
				return fmt.Errorf("unable to parse value %v: %w", bucket["key"], err)
			}
			payload, err := sadefs.EncodeValue(value, groupByTypes[index])
			if err != nil {
				return fmt.Errorf("unable to encode value %v: %w", value, err)
			}
			err = parseInternal(bucket, append(bucketValues, payload))
			if err != nil {
				return err
			}
		}
		return nil
	}

	var bucketsJson map[string]any
	dec := json.NewDecoder(bytes.NewReader(searchResult.Aggregations[groupByFields[0]]))
	dec.UseNumber()
	if err := dec.Decode(&bucketsJson); err != nil {
		return nil, serviceerror.NewInternalf("unable to unmarshal json response: %v", err)
	}
	if err := parseInternal(map[string]any{groupByFields[0]: bucketsJson}, nil); err != nil {
		return nil, err
	}

View on GitHub (pinned to bde624efd1)

When it happens

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

Common situations: See trigger scenarios.


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