{"record":{"id":"e02f3d5b5df926eb","repo":"grafana/loki","slug":"invalid-batch-size-for-query-engine-must-be-great","errorCode":null,"errorMessage":"invalid batch size for query engine. must be greater than 0, got %d","messagePattern":"invalid batch size for query engine\\. must be greater than 0, got (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/engine/basic_engine.go","lineNumber":45,"sourceCode":"\t\"github.com/grafana/loki/v3/pkg/logqlmodel/stats\"\n\t\"github.com/grafana/loki/v3/pkg/util/httpreq\"\n\tutillog \"github.com/grafana/loki/v3/pkg/util/log\"\n\t\"github.com/grafana/loki/v3/pkg/util/rangeio\"\n\t\"github.com/grafana/loki/v3/pkg/xcap\"\n)\n\n// ErrNotSupported is the public sentinel callers branch on (querier fallback,\n// HTTP 501). The canonical definition lives in the internal errors package so\n// it can be returned from inner packages such as the physical planner; this\n// re-export keeps the existing public surface stable.\nvar ErrNotSupported = internalerrors.ErrNotSupported\n\n// NewBasic creates a new instance of the basic query engine that implements the\n// [logql.Engine] interface. The basic engine executes plans sequentially with\n// no local or distributed parallelism.\nfunc NewBasic(cfg ExecutorConfig, ms metastore.Metastore, bucket objstore.Bucket, limits logql.Limits, reg prometheus.Registerer, logger log.Logger) *Basic {\n\tif cfg.BatchSize <= 0 {\n\t\tpanic(fmt.Sprintf(\"invalid batch size for query engine. must be greater than 0, got %d\", cfg.BatchSize))\n\t}\n\tif cfg.RangeConfig.IsZero() {\n\t\tcfg.RangeConfig = rangeio.DefaultConfig\n\t}\n\n\ttaskCaches, err := executor.NewTaskCacheRegistry(cfg.TaskResultsCache.Config, reg, logger)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"creating task results cache: %v\", err))\n\t}\n\n\treturn &Basic{\n\t\tlogger:     logger,\n\t\tmetrics:    newMetrics(reg),\n\t\tlimits:     limits,\n\t\tmetastore:  ms,\n\t\tbucket:     bucket,\n\t\tcfg:        cfg,\n\t\ttaskCaches: taskCaches,","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/grafana/loki/blob/24cfedd4f67b53367b63e273d64dbfc5ad307535/pkg/engine/basic_engine.go#L27-L63","documentation":"Error \"invalid batch size for query engine. must be greater than 0, got %d\" thrown in grafana/loki.","triggerScenarios":"Thrown at pkg/engine/basic_engine.go:45 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"24cfedd4f67b53367b63e273d64dbfc5ad307535","analyzedAt":"2026-08-15T20:47:01.143Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}