@@ -26,6 +26,7 @@ package sql
2626
2727import (
2828 "context"
29+ "errors"
2930 "fmt"
3031 "strings"
3132 "time"
@@ -42,6 +43,7 @@ import (
4243 "go.temporal.io/server/common/persistence/sql/sqlplugin"
4344 "go.temporal.io/server/common/persistence/visibility/manager"
4445 "go.temporal.io/server/common/persistence/visibility/store"
46+ "go.temporal.io/server/common/persistence/visibility/store/query"
4547 "go.temporal.io/server/common/resolver"
4648 "go.temporal.io/server/common/searchattribute"
4749)
@@ -374,6 +376,11 @@ func (s *VisibilityStore) ListWorkflowExecutions(
374376 )
375377 selectFilter , err := converter .BuildSelectStmt (request .PageSize , request .NextPageToken )
376378 if err != nil {
379+ // Convert ConverterError to InvalidArgument and pass through all other errors (which should be only mapper errors).
380+ var converterErr * query.ConverterError
381+ if errors .As (err , & converterErr ) {
382+ return nil , converterErr .ToInvalidArgument ()
383+ }
377384 return nil , err
378385 }
379386
@@ -447,6 +454,11 @@ func (s *VisibilityStore) CountWorkflowExecutions(
447454 )
448455 selectFilter , err := converter .BuildCountStmt ()
449456 if err != nil {
457+ // Convert ConverterError to InvalidArgument and pass through all other errors (which should be only mapper errors).
458+ var converterErr * query.ConverterError
459+ if errors .As (err , & converterErr ) {
460+ return nil , converterErr .ToInvalidArgument ()
461+ }
450462 return nil , err
451463 }
452464
0 commit comments