grafana/loki · error

invalid batch size for query engine. must be greater than 0,

Error message

invalid batch size for query engine. must be greater than 0, got %d

What it means

Error "invalid batch size for query engine. must be greater than 0, got %d" thrown in grafana/loki.

Source

Thrown at pkg/engine/basic_engine.go:45

	"github.com/grafana/loki/v3/pkg/logqlmodel/stats"
	"github.com/grafana/loki/v3/pkg/util/httpreq"
	utillog "github.com/grafana/loki/v3/pkg/util/log"
	"github.com/grafana/loki/v3/pkg/util/rangeio"
	"github.com/grafana/loki/v3/pkg/xcap"
)

// ErrNotSupported is the public sentinel callers branch on (querier fallback,
// HTTP 501). The canonical definition lives in the internal errors package so
// it can be returned from inner packages such as the physical planner; this
// re-export keeps the existing public surface stable.
var ErrNotSupported = internalerrors.ErrNotSupported

// NewBasic creates a new instance of the basic query engine that implements the
// [logql.Engine] interface. The basic engine executes plans sequentially with
// no local or distributed parallelism.
func NewBasic(cfg ExecutorConfig, ms metastore.Metastore, bucket objstore.Bucket, limits logql.Limits, reg prometheus.Registerer, logger log.Logger) *Basic {
	if cfg.BatchSize <= 0 {
		panic(fmt.Sprintf("invalid batch size for query engine. must be greater than 0, got %d", cfg.BatchSize))
	}
	if cfg.RangeConfig.IsZero() {
		cfg.RangeConfig = rangeio.DefaultConfig
	}

	taskCaches, err := executor.NewTaskCacheRegistry(cfg.TaskResultsCache.Config, reg, logger)
	if err != nil {
		panic(fmt.Sprintf("creating task results cache: %v", err))
	}

	return &Basic{
		logger:     logger,
		metrics:    newMetrics(reg),
		limits:     limits,
		metastore:  ms,
		bucket:     bucket,
		cfg:        cfg,
		taskCaches: taskCaches,

View on GitHub (pinned to 24cfedd4f6)

When it happens

Trigger: Thrown at pkg/engine/basic_engine.go:45 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/loki@24cfedd4f6 (2026-08-15). Data as JSON: /api/errors/e02f3d5b5df926eb. Report an issue: GitHub.