argoproj/argo-workflows · error

InvalidArgument

InvalidArgument

Error message

limit must be greater than zero

What it means

The syncServer facade validates req.Limit > 0 before dispatching to the type-specific provider. This is the outer duplicate of the provider-level check, giving a consistent gRPC error regardless of backend.

Source

Thrown at server/sync/sync_server.go:48

		providers: make(map[syncpkg.SyncConfigType]ConfigProvider),
	}

	server.providers[syncpkg.SyncConfigType_CONFIGMAP] = &configMapSyncProvider{}

	if syncConfig != nil && syncConfig.EnableAPI {
		sessionProxy := syncdb.SessionProxyFromConfig(ctx, kubectlConfig, namespace, syncConfig)
		if sessionProxy == nil {
			panic("was unable to create database connection")
		}
		server.providers[syncpkg.SyncConfigType_DATABASE] = &dbSyncProvider{db: syncdb.NewSyncQueries(sessionProxy, syncdb.ConfigFromConfig(syncConfig))}
	}

	return server
}

func (s *syncServer) CreateSyncLimit(ctx context.Context, req *syncpkg.CreateSyncLimitRequest) (*syncpkg.SyncLimitResponse, error) {
	if req.Limit <= 0 {
		return nil, sutils.ToStatusError(fmt.Errorf("limit must be greater than zero"), codes.InvalidArgument)
	}

	provider, ok := s.providers[req.Type]
	if !ok {
		return nil, sutils.ToStatusError(fmt.Errorf("unsupported sync config type: %s", req.Type), codes.InvalidArgument)
	}
	return provider.createSyncLimit(ctx, req)
}

func (s *syncServer) GetSyncLimit(ctx context.Context, req *syncpkg.GetSyncLimitRequest) (*syncpkg.SyncLimitResponse, error) {
	provider, ok := s.providers[req.Type]
	if !ok {
		return nil, sutils.ToStatusError(fmt.Errorf("unsupported sync config type: %s", req.Type), codes.InvalidArgument)
	}
	return provider.getSyncLimit(ctx, req)
}

func (s *syncServer) UpdateSyncLimit(ctx context.Context, req *syncpkg.UpdateSyncLimitRequest) (*syncpkg.SyncLimitResponse, error) {

View on GitHub (pinned to 35bff19146)

Solutions

  1. Send a positive integer limit in CreateSyncLimitRequest
  2. Fix client-side computation to guarantee >= 1
  3. Ensure the CLI/UI surfaces limit input as required

Example fix

// before
Limit: limitParam // may be 0
// after
if limitParam < 1 { return fmt.Errorf("limit must be >= 1") }
Limit: limitParam
Defensive patterns

Strategy: validation

Validate before calling

if req.Limit <= 0 { return errors.New("limit must be positive") }
if req.Type == syncpkg.SyncConfigType_UNSPECIFIED { return errors.New("sync config type required") }

Type guard

func validCreateReq(r *syncpkg.CreateSyncLimitRequest) bool { return r.Limit > 0 && r.Type != syncpkg.SyncConfigType_UNSPECIFIED }

Try / catch

_, err := syncClient.CreateSyncLimit(ctx, req)
if st, ok := status.FromError(err); ok && st.Code() == codes.InvalidArgument {
    return fmt.Errorf("request rejected: %v", st.Message())
}

Prevention

When it happens

Trigger: CreateSyncLimit RPC with Limit <= 0 on the sync server; the request is rejected before provider lookup.

Common situations: CLI/tools sending the zero-value int32, computed limits evaluating to 0, protobuf fields left unset.

Related errors


AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03). Data as JSON: /api/errors/73b5def39cc5f603. Report an issue: GitHub.