temporalio/temporal · error

%w: expected bool got %T

Error message

%w: expected bool got %T

What it means

Error "%w: expected bool got %T" thrown in temporalio/temporal.

Source

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

			return nil, fmt.Errorf("%w: expected string got %T", errUnexpectedJSONFieldType, val)
		}
		if t == enumspb.INDEXED_VALUE_TYPE_DATETIME {
			return time.Parse(time.RFC3339Nano, stringVal)
		}
		return stringVal, nil
	case enumspb.INDEXED_VALUE_TYPE_INT, enumspb.INDEXED_VALUE_TYPE_DOUBLE:
		numberVal, isNumber := val.(json.Number)
		if !isNumber {
			return nil, fmt.Errorf("%w: expected json.Number got %T", errUnexpectedJSONFieldType, val)
		}
		if t == enumspb.INDEXED_VALUE_TYPE_INT {
			return numberVal.Int64()
		}
		return numberVal.Float64()
	case enumspb.INDEXED_VALUE_TYPE_BOOL:
		boolVal, isBool := val.(bool)
		if !isBool {
			return nil, fmt.Errorf("%w: expected bool got %T", errUnexpectedJSONFieldType, val)
		}
		return boolVal, nil
	}

	panic(fmt.Sprintf("Unknown field type: %v", t))
}

func ConvertElasticsearchClientError(message string, err error, logger log.Logger) error {
	// This message is returned to client, avoiding including too much details.
	errMessage := fmt.Sprintf("%s: %s", message, shortErrorMessage(err))
	var elasticErr *elastic.Error
	switch {
	case errors.As(err, &elasticErr):
		// Logging the full error message, useful for debugging.
		logger.Error(message, tag.ESResponseStatus(elasticErr.Status), tag.Error(err))
		switch elasticErr.Status {
		case http.StatusBadRequest:
			// Returning InvalidArgument error will prevent retry on a caller side.

View on GitHub (pinned to bde624efd1)

When it happens

Trigger: Thrown at common/persistence/visibility/store/elasticsearch/visibility_store.go:1308 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/58c65ff36d42d296. Report an issue: GitHub.